您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

ThinkPHP中redirect用法分析

2024/11/28 21:27:30发布47次查看
这篇文章主要介绍了thinkphp中redirect用法,实例分析了redirect重定向的各种常见操作技巧,具有一定的实用价值,需要的朋友可以参考下
本文实例讲述了thinkphp中redirect用法。分享给大家供大家参考。具体分析如下:
redirect 重定向的通用语法为:redirect(url,params=array(),delay=0,msg=''),假设当前为默认 home分组 aritcle模块 insert操作,一些例子如下:
复制代码 代码如下:
// 跳转到 edit 操作 $this->redirect('edit'); // 跳转到 useraction下的edit 操作 $this->redirect('user/edit'); // 跳转到 admin分组默认模块默认操作 $this->redirect('admin/'); // 跳转到 admin分组index模块view操作 $this->redirect('admin-index/view'); // 跳转到 admin分组index模块view操作,uid参数为1,延迟3秒跳转 $this->redirect('admin-index/view', array('uid'=>1), 3,'页面跳转中~') // 跳转到 其他otherapp项目(非分组)的admin项目分组user模块view操作 $this->redirect('otherapp://admin-user/view');
同项目分组中的url访问一样,redirect 中跨分组跳转只是多了一个分组项目名称的概念.
提示:可以在 redirect 中使用路由,redirect 方法的参数用法和 u函数 的用法一致.可参考 u函数 生成url地址相关部分内容.
相关推荐:
thinkphp之r方法实例
以上就是thinkphp中redirect用法分析的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product