ThinkPHP redirect 页面重定向使用详解与实例
来源:互联网 发布:程序员鄙视链图 编辑:程序博客网 时间:2024/05/19 10:36
ThinkPHP redirect 方法
ThinkPHP redirect 方法可以实现页面的重定向(跳转)功能。redirect 方法语法如下:
$this->redirect(string url, array params, int delay, string msg)
参数说明:可选,重定向提示信息。
ThinkPHP redirect 实例
在 Index 模块 index 方法中,重定向到本模块的 select 操作:
class IndexAction extends Action{
public function index()
{
$this->redirect('select', array('status'=>1), 3, '页面跳转中~'); //3秒
}
}
一些常用的 redirect 重定向例子:
// 不延时,直接重定向$this->redirect('select', array('status'=>1));// 延时跳转,但不带参数,输出默认提示$this->redirect('select', '', 3);// 重定向到其他模块操作$this->redirect('Public/login');// 重定向到其他分组$this->redirect('Admin-Public/login');
提示:- 当延时跳转时,必须输入 params 参数(可以为空),也就是 delay 必须出现在第 3 位上。
- 如果发现跳转后的 URL 有问题,由于 redirect 方法调用 U 方法来生成跳转后的地址,这时候可以测试一下 U 方法生成的地址是否正确,再检查一下系统配置。
1 0
- ThinkPHP redirect 页面重定向使用详解与实例
- ThinkPHP redirect 页面重定向使用详解与实例
- 【Thinkphp】redirect重定向问题
- thinkphp页面重定向
- 页面的转发(dispatcher)与重定向(redirect)的区别
- Response.redirect实现页面重定向
- forward转发和redirect重定向详解
- forward转发和redirect重定向详解
- thinkphp中url重定向redirect方法学习
- 重定向(redirect)与管道(pipe)
- forward(转发)与redirect(重定向)
- thinphp中$this->redirect与redirect重定向区别
- thinkphp,此页面不能重定向
- ThinkPHP 页面跳转和重定向
- PHP页面跳转与页面重定向详解
- 转发与重定向的使用详解
- struts2 重定向 redirect
- Redirect,网页重定向
- C++入门——排序
- 定制Spring Boot的Banner
- CentOS7下安装solr服务器
- 微信公众号开发---模板消息url
- 你是不是想要个ideal汉化包?我这里有啊~
- ThinkPHP redirect 页面重定向使用详解与实例
- JQuery Ajax操作
- Windows 10 禁止远程连接
- Jenkins + Git + Maven + tomcat集成环境(Maven安装)
- ubuntu16.04 + hadoop2.7.2 完全分布式集群搭建(备查)
- Android-LinearLayout线性布局
- Android adb命令使用总结
- Pascal VOC 数据集介绍
- 关闭spring boot的banner