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('失败','跳转地址');
    }
}
相关推荐
csj501 天前
安卓基础之《(6)—Activity组件(3)》
android
怀旧,1 天前
【Linux系统编程】13. Ext系列⽂件系统
android·linux·缓存
Dabei1 天前
Android 语音助手简单实现与语音助手“执行任务”交流
android·前端
jzlhll1231 天前
android NDSDManager onResolveFailed errorCode=3的解决方案
android
芦半山1 天前
四年之后,重新审视 MTE:从硬件架构到工程落地
android·安全
2501_916007471 天前
iOS与Android符号还原服务统一重构实践总结
android·ios·小程序·重构·uni-app·iphone·webview
allk551 天前
Android 屏幕适配全维深度解析
android·性能优化·界面适配
Android系统攻城狮1 天前
Android ALSA驱动进阶之获取采样格式位宽snd_pcm_format_width:用法实例(九十八)
android·pcm·音频进阶·alsa驱动
莫比乌斯环1 天前
【日常随笔】Android 跳离行为分析 - Instrumentation
android·架构·代码规范
aningxiaoxixi1 天前
android 媒体之 MediaSession
android·媒体