更名为 traits\controller\jump 内置放入 \think\controller

继承 \think\Controller 后可以直接使用下面三个方法:
return $this->error('错误');
return $this->success('成功');
return $this->redirect('index/hello');
This commit is contained in:
thinkphp
2015-12-24 11:36:42 +08:00
parent 1b61dab806
commit 1f593930af
2 changed files with 7 additions and 3 deletions

View File

@@ -12,9 +12,11 @@
namespace think; namespace think;
T('controller/view'); T('controller/view');
T('controller/jump');
class Controller class Controller
{ {
use \traits\controller\jump;
use \traits\controller\view; use \traits\controller\view;
/** /**

View File

@@ -2,10 +2,10 @@
/** /**
* 用法: * 用法:
* T('controller/response'); * T('controller/jump');
* class index * class index
* { * {
* use \traits\controller\response; * use \traits\controller\jump;
* public function index(){ * public function index(){
* $this->error(); * $this->error();
* $this->redirect(); * $this->redirect();
@@ -14,7 +14,9 @@
*/ */
namespace traits\controller; namespace traits\controller;
trait Response use think\Response;
trait Jump
{ {
// 视图类实例 // 视图类实例
protected $view = null; protected $view = null;