#Yii Solution: Yii::app()->getBaseUrl() is returning empty string

Updated May 8, 2016 ‚óŹ 5,452 views

While coding one of my projects, I encountered the need to get the base url of my website. Apparently, Yii::app()->getBaseUrl() is returning an empty string.

To resolve this issue, I just passed true as a parameter:

<?php echo Yii::app()->getBaseUrl(true);?>

Follow Yii Channel for more Yii PHP Framework tips!


Our Terms of Use and Privacy Policy have changed.
By continuing to use this site, you are agreeing to the new Privacy Policy and Terms of Service.