Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要添加/注册一个 css 文件,但我无法获得frontend;
frontend
Yii 2 中的 YiiYii::app()->baseUrl等价物是什么?
Yii::app()->baseUrl
我试过了:
Yii::$app->basePath它给了我:c:/wamp/www/project/frontend
Yii::$app->basePath
c:/wamp/www/project/frontend
我只需要/project/frontend
/project/frontend
Yii 2 中的 Yii::app()->baseUrl 等效项是
\Yii::$app->request->BaseUrl
尝试这个
$baseUrl = Yii::app()->getBaseUrl(true); $scriptUrl = Yii::app()->request->scriptUrl; $themeUrl = Yii::app()->theme->getBaseUrl();