此处说明的控制器,指manage目录下的控制器。 管理端控制器放置在manage模块目录下的controller文件夹,所有后台控制器均要继承\app\common\controller\Manage控制器,如: ~~~ <?php namespace app\Manage\controller; use app\common\controller\Manage; /** * 测试控制器 */ class Test extends Manage { public function test(){} public function testView(){ $info ='test'; $this->assign('info',$info);// 将数据输出到view上 return $this->fetch('index');//此处不传index时,视图view地址为application\manage\view\test\testView.html。 } } ~~~ 后端所有控制器里面的public方法,均要加入权限控制中,具体如何加入,将在创建菜单节点中详细说明。如非权限控制,请在application\common\model\Operation.php 中 私有变量$noPerm的self::MENU_MANAGE 中加入你的控制器方法。 例如: ~~~ 'Test ' => ['test'], ~~~ ## 列表通用控制器方法 ``` //输出列表页面 public function index() { if (Request::isAjax()) { //对应模型 $testModel = new testModel(); $filter = input('request.'); $list = $testModel->tableData($filter); return $list ; } return $this->fetch('index'); } ```