Hello!
How i can set a base url?
Example:
When i do <?php echo Yii::app()->request->baseUrl; ?> i need to have a http://localhost/ … or whatever i want.
NOTE: i want to have http://localhost/css… or http://localhost/js… and not /js…
Thank you!
Hello!
How i can set a base url?
Example:
When i do <?php echo Yii::app()->request->baseUrl; ?> i need to have a http://localhost/ … or whatever i want.
NOTE: i want to have http://localhost/css… or http://localhost/js… and not /js…
Thank you!
Yii::app()->request->hostInfo will give you the part before the baseUrl, e.g.
if you’re running the site example.com hostInfo will be ‘http://example.com/’ (or ‘https://example.com/’).
if you’re running the site on your local machine hostInfo will be ‘http://localhost/’ (or ‘https://localhost/’).
Thanks for the reply.
Any way to set a baseUrl in my main.php?
What i don’t understand is why when i do echo Yii::app()->baseUrl i get nothing?
Try this
Yii::app()->user->baseUrl