1.

How To Get Current Url In Cakephp?

Answer»

To get current url in cakephp use, 

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

This will give full URL with hostname.If you want to get relative path instead of full URL,then use the FOLLOWING code:

echo $this->here;

This will PRODUCE absolute URL excluding hostname i.e. /controller/abc/xyz/

To get current url in cakephp use, 

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

This will give full URL with hostname.If you want to get relative path instead of full URL,then use the following code:

echo $this->here;

This will produce absolute URL excluding hostname i.e. /controller/abc/xyz/



Discussion

No Comment Found