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,.....))

扫描二维码关注公众号,回复: 2679674 查看本文章

失败:

当前控制器继承了父类控制器,父类中有定义其方法,所以可以直接使用

猜你喜欢

转载自blog.csdn.net/qq_36192232/article/details/81429602