命令行生成控制器
php think make:controller index/User
渲染模板
use think\View; $view = new View(); $view->assign('name','huyongjian'); return $view->fetch('index');
初始化方法
public function _initialize() { echo 'init<br/>'; }
成功和错误跳转
$this->success('新增成功', 'create');
$this->error('新增失败');
空操作
public function _empty($name) { echo 'empty:'.$name; }
空控制器
<?php namespace app\index\controller; use think\Request; class Error { public function index(Request $request) { echo 'error controller: '.$request->controller(); } }