简体   繁体   English

外部网址在PHP中不起作用

[英]External url is not working in PHP

I was wondering if anyone knew how to solve this. 我想知道是否有人知道如何解决这个问题。 Im using wordpress. 我正在使用wordpress。

I wanted to show the full url on a page. 我想在页面上显示完整的URL。 My code is like this: 我的代码是这样的:

<p><?php echo '<a href="'.$url.'" title="'.$work->post_title.'" target="blank">'.__($url, "").'</a>'  ?> </p>

You can see the url but when you click on it you'll get redirected to http:// Myownwebsite .com/ THE_URL 您可以看到该URL,但是单击该URL时,您将被重定向到http:// Myownwebsite .com / THE_URL

The problem is the “myownwebsite.com” part, how can I get rid of it? 问题是“ myownwebsite.com”部分,我该如何摆脱它? I've also tried 我也尝试过

<p><?php echo '<a href="'.$url.'"> '.$url.' </a>' ?> </p>

Any help ? 有什么帮助吗?

PS: Adding RewriteRule ^links$ %{QUERY_STRING} [L,R=301] to .htaccess doesn't help. PS:将RewriteRule ^ links $%{QUERY_STRING} [L,R = 301]添加到.htaccess没有帮助。

I've solved it. 我已经解决了 I have to use [http://www.] for $url instead of [www] I wanted to post this earlier, but stackoverflow didn't let me edit it for 8 hours. 我必须将[http:// www。]用作$ url而不是我想早些发布的[www],但是stackoverflow不允许我对其进行8个小时的编辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM