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('失败','跳转地址');
    }
}
相关推荐
Jomurphys14 分钟前
Kotlin - 类型别名 typealias
android·kotlin
Haha_bj23 分钟前
Flutter ——flutter_screenutil 屏幕适配
android·ios
Haha_bj41 分钟前
Flutter ——device_info_plus详解
android·flutter·ios
前端小伙计1 小时前
Android/Flutter 项目统一构建配置最佳实践
android·flutter
Mr_sun.2 小时前
Day09——入退管理-入住-2
android·java·开发语言
ujainu3 小时前
告别杂乱!Flutter + OpenHarmony 鸿蒙记事本的标签与分类管理(三)
android·flutter·openharmony
常利兵4 小时前
Android内存泄漏:成因剖析与高效排查实战指南
android
·云扬·4 小时前
MySQL 8.0 Redo Log 归档与禁用实战指南
android·数据库·mysql
野生技术架构师4 小时前
SQL语句性能优化分析及解决方案
android·sql·性能优化
doupoa5 小时前
内存指针是什么?为什么指针还要有偏移量?
android·c++