success();在success模板中做了一个连接,地..."/> success();在success模板中做了一个连接,地...">

thinkphp链接跳转的地址问题

WBOY
Release: 2016-06-06 20:52:29
Original
1499 people have browsed it

在一个模块中的一个方法中用assign()将__APP__赋给jumpUrl变量,即$this->assign("jumpUrl","___APP__/Public/main");然后$this->success();在success模板中做了一个连接,地址为{$jumpUrl},这样的话得到的地址没有前面的http://localhost/,怎么办呢?难道要手动加上http://localhost/吗?有没有别的办法?

回复内容:

在一个模块中的一个方法中用assign()将__APP__赋给jumpUrl变量,即$this->assign("jumpUrl","___APP__/Public/main");然后$this->success();在success模板中做了一个连接,地址为{$jumpUrl},这样的话得到的地址没有前面的http://localhost/,怎么办呢?难道要手动加上http://localhost/吗?有没有别的办法?

你的问题格式有点不清楚,最好整理下,你确认你是这么赋值的?

$this->assign("jumpUrl","___APP__/Public/main");
Copy after login

应该是这样吧

$this->assign("jumpUrl",__APP__ . "/Public/main");
Copy after login

使用ThinkPHP处理URL,我一般使用U()方法,你可以看看U方法的参数,有一个参数是可以输出完整的URL的。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!