多級控制器
新版支持任意層(ceng)次級別的(de)控制器,并且支持路由,例如(ru):
namespace app\index\controller\one;
use think\Controller;
class Blog extends Controller
{
public function index()
{
return $this->fetch();
}
public function add()
{
return $this->fetch();
}
public function edit($id)
{
return $this->fetch();
}
}
該控制(zhi)器類(lei)的文件(jian)位置為:
application/index/controller/one/Blog.php
訪問地址可(ke)以使用
http://serverName/index.php/index/one.blog/index
如(ru)果要在路(lu)由定義(yi)中使用(yong)多級控制器(qi),可以使用(yong):
\think\Route::get('blog/add','index/one.Blog/add');
文檔最后更新時間:2018-04-26 09:12:15
未解決你的問題?請到「問答社區」反饋你遇到的問題
