新版支持任意层次级别的控制器,并且支持路由,例如:
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(); } }
该控制器类的文件位置为:
application/index/controller/one/Blog.php
访问地址可以使用
http://serverName/index.php/index/one.blog/index
如果要在路由定义中使用多级控制器,可以使用:
\think\Route::get('blog/add','index/one.Blog/add');