跪求、在php中怎么用redirect实现页面跳转?????

如题所述

1、thinkPHP 的Action类的redirect方法可以实现页面的重定向功能,redirect 重定向的通用语法为:edirect(url,params=array(),delay=0,msg='') // 跳转到 edit 操作  $this->redirect('edit')。

2、// 跳转到 UserAction下的edit 操作 this->redirect('User/edit'),// 跳转到 Admin分组默认模块默认操作$this->redirect('Admin/')。

3、// 跳转到 Admin分组Index模块view操作$this->redirect('Admin-Index/view'),// 跳转到 Admin分组Index模块view操作,uid参数为1,延迟3秒跳转    $this->redirect('Admin-Index/view', array('uid'=>1)。

4、同项目分组中的URL访问一样,redirect 中跨分组跳转只是多了一个分组项目名称的概念,可以在 redirect 中使用路由,redirect 方法的参数用法和 U函数 的用法一致,可参考 U函数 生成URL地址相关部分内容。

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-11-24
redirect不是php内置的函数。一般用header().
header('Location: ');追问

那在yii框架中呢???

追答

1. Yii::app()->user->returnUrl = Yii::app()->getBaseUrl()."/step/show/id/1";
$this->redirect(Yii::app()->user->returnUrl);
2. $this->redirect(array('step/show','id'=>1));
3. $this->render('index',array('post'=>$questions));
4. $this->renderPartial('field_show',array('field'=>$field,'key'=>++$key,));

追问

谢啦、、、

本回答被提问者采纳
第2个回答  2011-09-27
header("location:XXXX.php");
第3个回答  2011-09-27
$this->redirect

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网