How to Get current URL in CakePHP?

Report
Question
117 views

Please explain why do you think this question should be reported?

Report Cancel

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/

Please follow and like us:

About the Author