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
Yii 2中的Yii :: app()-> baseUrl等效为
\Yii::$app->request->BaseUrl
try this
$baseUrl = Yii::app()->getBaseUrl(true);
$scriptUrl = Yii::app()->request->scriptUrl;
$themeUrl = Yii::app()->theme->getBaseUrl();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.