多級控制器

新版支持任意層次級別的控制器,并且支持路由,例如:

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');
文檔最后更新時間:2018-04-26 09:12:15

文檔
目錄

深色
模式

切換
寬度