Yii::app()->baseUrl equivalent in Yii 2 is
\Yii::$app->request->BaseUrl
Question
I need to add/register a css file but I cant get the path to the frontend
;
What's the Yii Yii::app()->baseUrl
equivalent in Yii 2 ?
I tryed:
Yii::$app->basePath
and it gives me : c:/wamp/www/project/frontend
I only need /project/frontend
Solution
Yii::app()->baseUrl equivalent in Yii 2 is
\Yii::$app->request->BaseUrl
OTHER TIPS
try this
$baseUrl = Yii::app()->getBaseUrl(true);
$scriptUrl = Yii::app()->request->scriptUrl;
$themeUrl = Yii::app()->theme->getBaseUrl();