Getting baseurl in any framework is easy. But development URL in cakephp 3 in view file…took time…For adding css or js or other purpose we need base path cakephp.
While doing development my path was http://localhost/cakephp3/. I wanted to fetch that in my site.
Their are many ways we can get the path.
You can use any one method of following :
echo $this->Html->url('/', true)
Define constant in Config/core.php as given bellow:
Then you can use BASE_URL in view file.
For view file you can use following code.
<?php echo $this->Url->build('/', true); ?>
I used above code reference to following URL: