thinkphp-jump 适用于 thinkphp6.0 的跳转扩展开源项目

我要开发同款
匿名用户2019年12月08日
122阅读

技术信息

开源地址
https://github.com/liliuwei/thinkphp-jump
授权协议
Apache

作品详情

thikphp-jump

适用于thikphp6.0的跳转扩展

安装composerrequireliliuwei/thikphp-jump配置//安装之后会在cofig目录里生成jump.php配置文件retur[//默认跳转页面对应的模板文件'dispatch_success_tmpl'=>app()->getRootPath().'/vedor/liliuwei/thikphp-jump/src/tpl/dispatch_jump.tpl','dispatch_error_tmpl'=>app()->getRootPath().'/vedor/liliuwei/thikphp-jump/src/tpl/dispatch_jump.tpl',];用法示例

使用use\liliuwei\thik\Jump;

在所需控制器内引用该扩展即可:

<?phpamespaceapp\admi\cotroller;classIdex{use\liliuwei\thik\Jump;publicfuctiodemo1(){/***操作成功跳转的快捷方法*@parammixed$msg提示信息*@paramstrig$url跳转的URL地址*@parammixed$data返回的数据*@paramiteger$wait跳转等待时间*@paramarray$header发送的Header信息*///一般用法retur$this->success('登录成功','idex/idex');//完整用法//retur$this->success($msg='登录成功',$url='idex/idex',$data='',$wait=3,$header=[]);}publicfuctiodemo2(){/***操作错误跳转的快捷方法*@parammixed$msg提示信息*@paramstrig$url跳转的URL地址*@parammixed$data返回的数据*@paramiteger$wait跳转等待时间*@paramarray$header发送的Header信息*///一般用法retur$this->error('登录失败');//retur$this->success('登录失败','logi/idex');//完整用法//retur$this->error($msg='登录失败',$url='logi/idex',$data='',$wait=3,$header=[]);}publicfuctiodemo3(){/***URL重定向*@paramstrig$url跳转的URL表达式*@paramiteger$codehttpcode*@paramarray$with隐式传参*///一般用法//第一种方式:直接使用完整地址(/打头)//retur$this->redirect('/admi/idex/idex');//第二种方式:如果你需要自动生成URL地址,应该在调用之前调用url函数先生成最终的URL地址。retur$this->redirect(url('idex/idex',['ame'=>'thik']));//retur$this->redirect('https://www.thikphp.c');//完整用法//retur$this->redirect($url='/admi/idex/idex',$code=302,$with=['data'=>'hello']);}publicfuctiodemo4(){/***返回封装后的API数据到客户端*@parammixed$data要返回的数据*@paramiteger$code返回的code*@parammixed$msg提示信息*@paramstrig$type返回数据格式*@paramarray$header发送的Header信息*///一般用法retur$this->result(['userame'=>'liliuwei','sex'=>'男']);//完整用法//retur$this->result($data=['userame'=>'liliuwei','sex'=>'男'],$code=0,$msg='',$type='',$header=[]);}}

功能介绍

thinkphp-jump 适用于thinkphp6.0的跳转扩展 安装
composer require liliuwei/thinkphp-jump 配置
// 安装之后会在conf...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论