我需要添加/註冊一個css文件,但我無法獲得路徑frontend
;Yii 2前端和後端路徑
Yii 2中Yii Yii::app()->baseUrl
是什麼?
我tryed:
Yii::$app->basePath
,這讓我:c:/wamp/www/project/frontend
我只需要/project/frontend
我需要添加/註冊一個css文件,但我無法獲得路徑frontend
;Yii 2前端和後端路徑
Yii 2中Yii Yii::app()->baseUrl
是什麼?
我tryed:
Yii::$app->basePath
,這讓我:c:/wamp/www/project/frontend
我只需要/project/frontend
的Yii ::應用程序() - >的baseUrl相當於Yii中2
\Yii::$app->request->BaseUrl
試試這個
$baseUrl = Yii::app()->getBaseUrl(true);
$scriptUrl = Yii::app()->request->scriptUrl;
$themeUrl = Yii::app()->theme->getBaseUrl();
這不會在yii2中工作。 – mohit
你爲什麼只需要'/ project/frontend'?它是你的webroot的相對路徑嗎? – Jurik
我在尋找yii2的源代碼,那就是url的格式;我想保持這種格式 –