Skip to content
Advertisement

How to get complete current url for Cakephp

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

Advertisement

Answer

You can do either

From a view file:

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

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

Or

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

which should give you the full url with the hostname.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement