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

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

问题描述

如何在 Cake 的视图中回显当前 URL?

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

推荐答案

你可以做任何一个

来自视图文件:

<?php echo $this->request->here() ?>">

哪个会给你来自主机名的绝对网址,即/controller/action/params

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

<?php echo Router::url(null, true) ?> 

它应该为您提供带有主机名的完整网址.

which should give you the full url with the hostname.

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

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