我需要添加/注册一个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的格式;我想保持这种格式 –