Yii::app()->request->baseUrl doesn't work


The code

Yii::app()->request->baseUrl works on windows

When I put all of the code into Linux.

print_r(Yii::app()->request->baseUrl). it’s empty

any reasons?

The value is empty

That’s because it returns a relative url as default, and I’m assuming your site isnt located in subfolders etc.

To get the absolute baseUrl: var_dump(Yii::app()->request->getBaseUrl(true));