Cakephp 2.x HTML 外部链接助手不起作用

发布于 2025-01-08 12:38:51 字数 250 浏览 5 评论 0原文

我正在执行以下操作:

<?php echo $this->Html->link('click here', 'www.notw.com', array('target' => '_blank')); ?>

尽管如此,创建的指向: mysite.local/current_controller/www.notw.com

如何使我的链接对外部正常工作?

谢谢

I'm doing the following:

<?php echo $this->Html->link('click here', 'www.notw.com', array('target' => '_blank')); ?>

Still, the created points to: mysite.local/current_controller/www.notw.com

How can I make my link to work properly for externals?

Thx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

没有你我更好 2025-01-15 12:38:52

也许您应该尝试 http://www.notw.com 而不仅仅是 www

要解决这个问题,无需协议,即。 http 或 https 只需添加 //
在 url 之前,它会自动为您解析协议。

<?php echo $this->Html->link('click here', '//www.notw.com', array('target' => '_blank')); ?> 

Perhaps you should try http://www.notw.com instead of just www.

To resolve this w/o the protocol ie. http or https just add //
before url and it will auto resolve the protocol for you.

<?php echo $this->Html->link('click here', '//www.notw.com', array('target' => '_blank')); ?> 
晚雾 2025-01-15 12:38:52
echo $this->Html->link('Link Text Here', 'http://www.anywebsiteyouwant.com');
echo $this->Html->link('Link Text Here', 'http://www.anywebsiteyouwant.com');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文