Wednesday, May 11, 2016

How to get the base Url in cakephp3?

 If you do need to get the base URL in CakePHP3 , you can use the Router class:


//without http://website.domain.com/app
echo Router::url('/')       //-> /my_app
//with http://website.domain.com/app
echo
Router::url('/', true) //-> http://site.domain.com/my_app