当前位置: 代码网 > it编程>编程语言>Php > ThinkPHP 6 添加跳转提示扩展 liliuwei/thinkphp-jump的操作方法

ThinkPHP 6 添加跳转提示扩展 liliuwei/thinkphp-jump的操作方法

2024年06月02日 Php 我要评论
liliuwei/thinkphp-jump 是 tp5 中经典跳转提示,在 tp6 中已经取消,通过 composer 下载该扩展可以在 tp6 中使用 tp5 的跳转提示操作。安装扩展在应用根目录

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

在这里插入图片描述

安装扩展

在应用根目录执行:

composer require liliuwei/thinkphp-jump

引入扩展

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

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',
];

使用扩展

<?php
namespace app\controller;
class index 
{
    // 在控制器中引入 jump
    use \liliuwei\think\jump; 
    public function index(){
        return  $this->success('成功','跳转地址');
        return  $this->error('失败','跳转地址');
    }
}

到此这篇关于thinkphp 6 添加跳转提示扩展 liliuwei/thinkphp-jump的文章就介绍到这了,更多相关thinkphp跳转扩展内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com