thinkphp6 入门(7)-- 跳转提示

liliuwei/thinkphp-jump 是 TP5 中经典跳转提示,在 TP6 中已经取消,通过 composer 下载该扩展可以在 TP6 中使用 TP5 的跳转提示操作。

安装扩展
在应用根目录执行:

composer require liliuwei/thinkphp-jump


使用扩展

<?php
namespace app\controller;

class Index 
{
    // 在控制器中引入 Jump
    use \liliuwei\think\Jump; 

    public function index(){
        return  $this->success('成功','跳转地址');
        return  $this->error('失败','跳转地址');
    }
}

也可以将

use \liliuwei\think\Jump;

放置到BaseController.php里


原文链接:https://blog.csdn.net/wkj001/article/details/132044497

猜你喜欢

转载自blog.csdn.net/u013288190/article/details/133831400