Yii:获取根目录的方法

1、在index.php文件中使用dirname(__FILE__),并保存

2、使用Yii::app()->basePath, 这个指向的是protected目录,再回退一级目录即可:Yii::app()->basePath.’/../’

3、使用Yii::getPathOfAlias(‘webroot’).’/’

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>