我的本地目录是D:\xampp\htdocs\yii\wwwroot\test1\
我想获取到D:\xampp\htdocs\yii\wwwroot\test1\
但是用Yii::app()->BasePath获取到的是D:\xampp\htdocs\yii\wwwroot\test1\protected
多了一个protected
有什么方法可以直接获取到D:\xampp\htdocs\yii\wwwroot\test1\呢?
我的本地目录是D:\xampp\htdocs\yii\wwwroot\test1\
我想获取到D:\xampp\htdocs\yii\wwwroot\test1\
但是用Yii::app()->BasePath获取到的是D:\xampp\htdocs\yii\wwwroot\test1\protected
多了一个protected
有什么方法可以直接获取到D:\xampp\htdocs\yii\wwwroot\test1\呢?
可以用
dirname(Yii::app()->BasePath)
或者:Yii::getPathOfAlias('webroot')
多谢两位的解答
文档不是说是BasePath是“the root directory of the application”吗?为什么不是获取到的不是根目录呢?为什么多了protected呢?
getPathOfAlias的参数哪里有详细说明?
现在很明白了,多谢