ThinkPHP 6 添加跳转提示扩展 liliuwei/thinkphp-jump

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

安装扩展

在应用根目录执行:

html 复制代码
composer require liliuwei/thinkphp-jump

引入扩展

在全局配置目录生成 jump.php 文件:

html 复制代码
return[
    // 默认跳转页面对应的模板文件
    'dispatch_success_tmpl' => app()->getRootPath().'/vendor/liliuwei/thinkphp-jump/src/tpl/dispatch_jump.tpl',
    'dispatch_error_tmpl'   => app()->getRootPath().'/vendor/liliuwei/thinkphp-jump/src/tpl/dispatch_jump.tpl',
];

使用扩展

html 复制代码
<?php
namespace app\controller;

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

    public function index(){
        return  $this->success('成功','跳转地址');
        return  $this->error('失败','跳转地址');
    }
}
相关推荐
山峰哥12 小时前
SQL性能飙升秘籍:从索引策略到查询优化全解析
android
黄林晴12 小时前
稳定性全面升级!Compose Multiplatform 1.11 RC 正式推送
android
恋猫de小郭12 小时前
实用性 Max ,新 Flutter & Dart Agent Skills 深度解读
android·前端·flutter
重生之小比特12 小时前
【MySQL 数据库】表的约束
android·数据库·mysql
Kapaseker12 小时前
Android 中的 MVVM 是如何构建起来的
android·kotlin
_李小白13 小时前
【android opencv学习笔记】Day 9: 颜色检测算法
android·opencv·学习
三少爷的鞋13 小时前
Repository 一定需要 DataSource 吗?一篇讲透的架构思考
android
荣月灵的小梅花1 天前
在Android 9上修改build.fingerprint
android
帅次1 天前
Compose 入门:@Composable、组合与重组
android·kotlin·gradle·android jetpack·compose·composable
洞见前行1 天前
APK Signing Block V2 多渠道分包技术原理
android