tp6 使用$this->success() $this->error() redirect() 完成转跳方法

官方系统不再提供基础控制器类think\Controller,原来的success、error、redirect和result方法需要自己在基础控制器类里面实现。
tp6 使用$this->success() $this->error() redirect() 完成转跳方法_第1张图片
1.安装下面的扩展用于支持旧版本的跳转操作
composer require liliuwei/thinkphp-jump
tp6 使用$this->success() $this->error() redirect() 完成转跳方法_第2张图片
2.在app下的BaseController.php 文件中添加:
use \liliuwei\think\Jump;要在下面加
tp6 使用$this->success() $this->error() redirect() 完成转跳方法_第3张图片
然后在使用,继承一下
tp6 使用$this->success() $this->error() redirect() 完成转跳方法_第4张图片
tp6 使用$this->success() $this->error() redirect() 完成转跳方法_第5张图片
注意:这句话加在上面会报错:
Call to undefined method app\admin\controller\login::success()

你可能感兴趣的:(学习笔记,thinkphp)