Common paths in Yii (goto)
Http://hi.baidu.com/design231/item/e4fea9db57d76fc71a72b4bc
Call the YII framework in Jquery:yii::app ()->clientscript->registercorescript (' jquery ');
Framework/web/js/source JS, where registercorescriptkey called files can be viewed in the framework/web/js/packages.php list
Get the ID of the current controller in view method: Yii::app ()->getcontroller ()->id;
Get the ID method of the current action in view: Yii::app ()->getcontroller ()->getaction ()->id;
YII Get IP Address: Yii::app ()->request->userhostaddress;
Yii Judgment Submission Method: Yii::app ()->request->ispostrequest
Get current domain name: Yii::app ()->request->hostinfo
Get the physical path to the proteced directory: Yii::app ()->basepath;
Get the URL of the previous page to return: Yii::app ()->request->urlreferrer;
Get current Url:yii::app ()->request->url;
Get current Home Url:yii::app ()->homeurl
Get current return Url:yii::app ()->user->returnurl
Project path: DirName (Yii::app ()->basepath)
One: The YII framework has defined namespace constants
System: Point to the YII framework directory; Yii\framework
Zii: Point to zii Library directory; Yii\framework\zii
Application: Point to the application base directory; protected\
Webroot: Point to the directory containing the entry script file; .\
Ext: Point to the directory containing all third-party extensions; \protected\extensions
Usage: Yii::getpathofalias (' Webroot ')
Two: {full URL}: Get the current complete path
Yii::getframeworkpath (): YII Framework Path
Three:
Insert meta Information Yii::app ()->clientscript->registermetatag (' keywords ', ' keywords '); Yii::app ()->clientscript->registermetatag (' description ', ' some descriptions '); Yii::app ()->clientscript->registermetatag (' author ', ' author ');
Example:
<link rel= "Alternate" type= "Application/rss+xml" href= "http://www.dreamdu.com/feed/"/>
Expressed as:
Yii::app ()->clientscript->registerlinktag (' alternate ', ' Application/rss+xml ', $this->createurl ('/feed ') );
Add a CSS file or JavaScript file to the Controller Yii::app ()->clientscript->registercssfile (Yii::app ()->baseurl. /css/my.css '); Yii::app ()->clientscript->registerscriptfile (Yii::app ()->baseurl. /css/my.js ');
Gets the ID method of the current controller in view Yii::app ()->getcontroller ()->id;
Get the ID method of the current action in view: Yii::app ()->getcontroller ()->getaction ()->id;
Yii Gets the IP address Yii::app ()->request->userhostaddress;
Yii Judgment Submission Method Yii::app ()->request->ispostrequest
Get current domain name: Yii::app ()->request->hostinfo
Get the physical path to the proteced directory Yii::app ()->basepath;
Get the URL of the previous page to return to Yii::app ()->request->urlreferrer;
Get current URL
Yii::app ()->request->url;
Get the current home URL
Yii::app ()->homeurl
Get the current return URL
Yii::app ()->user->returnurl
Project path
DirName (Yii::app ()->basepath)