如何获得Cakephp完整的当前网址 [英] How to get complete current url for Cakephp

查看:89
本文介绍了如何获得Cakephp完整的当前网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

您可以执行

$ b $

b

从视图文件:

 <?php echo $ this-& ?> 

这将给你绝对url从主机名ie / controller / action / params



 <?php echo Router :: url($ this-> ;这里,true); ?> 

这将为您提供主机名的完整网址。


How do you echo out current URL in Cake's view?

解决方案

You can do either

From a view file:

<?php echo $this->here; ?>

Which will give you the absolute url from the hostname i.e. /controller/action/params

Or

<?php echo Router::url( $this->here, true ); ?> 

which should give you the full url with the hostname.

这篇关于如何获得Cakephp完整的当前网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆