Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Yii 2前端和后端的路径_Php_Yii_Yii2 - Fatal编程技术网

Php Yii 2前端和后端的路径

Php Yii 2前端和后端的路径,php,yii,yii2,Php,Yii,Yii2,我需要添加/注册css文件,但无法获取前端的路径 yii2中的Yii-Yii::app->baseUrl等价物是什么 我试着: Yii::$app->basePath,它给了我:c:/wamp/www/project/frontend 我只需要/project/frontendYii::app->baseUrl,Yii 2中的等效项是 \Yii::$app->request->BaseUrl Yii::app->baseUrl在Yii 2中的等价物是 \Yii::$app-

我需要添加/注册css文件,但无法获取前端的路径

yii2中的Yii-Yii::app->baseUrl等价物是什么

我试着:

Yii::$app->basePath,它给了我:c:/wamp/www/project/frontend


我只需要/project/frontend

Yii::app->baseUrl,Yii 2中的等效项是

  \Yii::$app->request->BaseUrl

Yii::app->baseUrl在Yii 2中的等价物是

  \Yii::$app->request->BaseUrl
试试这个

   $baseUrl = Yii::app()->getBaseUrl(true);
   $scriptUrl = Yii::app()->request->scriptUrl;
   $themeUrl = Yii::app()->theme->getBaseUrl();
试试这个

   $baseUrl = Yii::app()->getBaseUrl(true);
   $scriptUrl = Yii::app()->request->scriptUrl;
   $themeUrl = Yii::app()->theme->getBaseUrl();

为什么您只需要/项目/前端?它是你的webroot的相对路径吗?我在查找yii2的源代码,这就是URL的格式;我想保持这种格式为什么只需要/project/frontend?它是你的webroot的相对路径吗?我在查找yii2的源代码,这就是URL的格式;我想保持这种格式