thinkphp跳转和重定向
2015-08-06 16:38
519 查看
$User = M('User');
$result = $User->add($data);
if(){
//第一个参数表示提示信息,第二个参数表示跳转地址,第三个参数表示跳转时间,单位为秒
$this->success('新增成功','User/list',3);
}else{
//error方法默认跳转地址是javascript:history.back(-1);
//默认等待时间success是1秒,error是3秒
$this->error('新增失败');
}
Controller类的redirect方法可以实现页面的重定向功能
//重定向到New模块的Category操作,停留5秒后,第二个参数是需要传递的参数
$this->redirect('New/category',array('cate_id'=>2),5,'页面跳转中');
redirect函数重定向
redirect('/New/category/cate_id/2',5,'页面跳转中');
注意:仅仅是想要重定向一个指定的URL地址,而不是到某个模块的操作方法,可以直接使用redirect函数
$result = $User->add($data);
if(){
//第一个参数表示提示信息,第二个参数表示跳转地址,第三个参数表示跳转时间,单位为秒
$this->success('新增成功','User/list',3);
}else{
//error方法默认跳转地址是javascript:history.back(-1);
//默认等待时间success是1秒,error是3秒
$this->error('新增失败');
}
Controller类的redirect方法可以实现页面的重定向功能
//重定向到New模块的Category操作,停留5秒后,第二个参数是需要传递的参数
$this->redirect('New/category',array('cate_id'=>2),5,'页面跳转中');
redirect函数重定向
redirect('/New/category/cate_id/2',5,'页面跳转中');
注意:仅仅是想要重定向一个指定的URL地址,而不是到某个模块的操作方法,可以直接使用redirect函数
相关文章推荐
- thinkphp判断请求类型
- thinkphp自动验证
- thinkphp自动填充
- thinkphp验证码
- thinkphp模板中变量输出
- thinkphp访问域名隐藏
- thinkphp截取字符串函数
- thinkphp查询数据
- php获取数组长度函数
- cakephp2.7的学习笔记1 —— 安装与配置
- ThinkPHP的RBAC权限控制
- php 文件写入
- PHP计算年龄、
- PHP 生成唯一激活码
- phpwind和discuz
- ThinkPHP 3 介绍及安装
- yii关系relations之HAS_MANY之排序
- vsftpd.conf备份
- 【细说PHP学习】第十七章 MySQL数据库概述
- php中mail函数使用