1:
YiiBase::getPathOfAlias('webroot')
例:$filepath = YiiBase::getPathOfAlias('webroot').'/upload/usercard/'
其中的 RootAlias
是某个现存目录的别名。
通过使用 YiiBase::getPathOfAlias(), 别名可以被翻译为其相应的路径。 例如, system.web.CController
会被翻译为 yii/framework/web/CController
。
通过调用 YiiBase::setPathOfAlias(),我们可以定义新的根路径别名。
system
: 表示 Yii 框架目录;
zii
: 表示 Zii 库 目录;application
: 表示应用的 基础目录;webroot
: 表示 入口脚本 文件所在的目录。此别名从版本 1.0.3 开始有效。ext
: 表示包含了所有第三方 扩展 的目录。此别名从版本 1.0.8 开始有效。