candy110 2015-07-01 20:47:27 19267次浏览 4条评论 11 5 0

//YII framework路径
Yii::getFrameworkPath();

//protected/runtime
Yii::app()->getRuntimePath();

//在view中得到当前controller的ID方法:
Yii::app()->getController()->id;

//在view中得到当前action的ID方法
Yii::app()->getController()->getAction()->id;

//yii获取ip地址
Yii::app()->request->userHostAddress;

//yii判断提交方式
Yii::app()->request->isPostRequest;

//得到当前域名:
Yii::app()->request->hostInfo;

//得到proteced目录的物理路径
Yii::app()->basePath;

//获得上一页的url以返回
Yii::app()->request->urlReferrer;

//得到当前url
Yii::app()->request->url;

//得到当前home url
Yii::app()->homeUrl;

//得到当前return url
Yii::app()->user->returnUrl

//项目路径
dirname(Yii::app()->BasePath);

ps:引自http://lxy.me/summary-of-common-path-in-yii.html

觉得很赞
您需要登录后才可以评论。登录 | 立即注册