ThinkPHP框架的系统跳转方法
ThinkPHP框架的系统跳转方法
成功跳转:
$this->success(跳转提示,跳转地址,等待时间)
失败跳转:
$this->error(跳转提示,跳转地址,等待时间)
跳转提示参数必须有,其他可以省略,如没有跳转地址,则跳上一页。
<?php namespace Admin\Controller; use Think\Controller; class TestController extends Controller{ public function test(){ echo "Hello World"; } public function test1(){ //成功跳转 $this->success('操作成功',U('test'),10); } public function test2(){ //失败跳转 $this->error('操作失败',U('test'),10); } }
控制器U方法 U('[分组名/控制器名/]方法名',array('参数1'=>参数值1,'参数12'=>参数值2,.....))
失败:
当前控制器继承了父类控制器,父类中有定义其方法,所以可以直接使用