+ -
当前位置:首页 → 问答吧 → 关于tp2.1,redirect求助,谢谢

关于tp2.1,redirect求助,谢谢

时间:2011-05-26

来源:互联网

昨天才开始学习tp2.1,这就遇到问题了
$this->redirect('Index/index');
但是最后的URL地址却会变成:
http://xxx.xxx.xxx/Admin_App/admin.php/Admin_App//Index/index
但我实际需要跳转的地址是:
http://xxx.xxx.xxx/Admin_App/admin.php/Index/index

也就说,默认的$this->redirect方法会在url中加上项目名。

完全是按照ThinkPHP2.1 完全开发手册的例子做的,
就第一个例子,晕死了。。。
这个跳转的路径总是有问题

顺便说一下。
我的tp包在项目文件夹下。
不是和项目文件夹在同一文件夹内。

作者: 198635wjy   发布时间: 2011-05-26

你用 模板替换 试一试
  1. $this->redirect(__APP__.'/Index/index');
复制代码

作者: tp_xiaowang   发布时间: 2011-05-26

tp_xiaowang

不行啊。
照你的方法得到的是
http://x.x.x.x/App/index.php/App//App/index.php/Index/index
多了两个项目名称呢

作者: 198635wjy   发布时间: 2011-05-26

恐怕你的入口文件就有问题 app_path 之类的设置不对

作者: thinkphp   发布时间: 2011-05-26