Current page url Yii: app ()-> request-> url;
Jump to the url of the previous page $ this-> redirect (Yii: app ()-> request-> urlReferrer );
Root directory URL Yii: app ()-> baseUrl or Yii: app ()-> request-> baseUrl;
Custom URL $ this-> createUrl ('Post/read', array ('id' => 100) or Yii: app ()-> createUrl ();
Current Project: Yii: getPathOfAlias ('webroot ');
HOST: Yii: app ()-> request-> hostInfo http: // 127.0.0.1
Project homepage Yii: app ()-> homeUrl/blog/index. php
If the browser is relocated to the logon page and the logon succeeds, we will relocate the browser to the page that causes verification failure. How do we know this value? We can use the returnUrl attribute of the user part. Therefore, we can use the following to execute redirection:
Yii: app ()-> request-> redirect (Yii: app ()-> user-> returnUrl );
Rendering view $ this-> render ('view', array ('bubute1' => 'value1 ', 'bubute2' => 'value2 '));
Jump to the page $ this-> redirect (array ('route ', 'bubute1' => 'value1', 'bubute2' => 'value2 '));
Create a widget $ this-> beginWidget (string $ className, array $ properties = array ())
$ This-> endWidget ();
Partial rendering renderPartial ('view', array ('bubute1' => 'value1 ', 'bubute2' => 'value2 '));
This method differs from render () in that it does not apply a layout to the rendered result. It is thus mostly used in rendering a partial view, or an AJAX response.
Call jquery: YII: app ()-> clientScript-> registerCoreScript ('jquery ') in the Yii framework ');
Framework/web/js/source js. The file called by registerCoreScriptkey can be viewed in the framework/web/js/packages. php list.
In the view, obtain the current controller ID method: Yii: app ()-> getController ()-> id;
Obtain the ID of the current action in the view: Yii: app ()-> getController ()-> getAction ()-> id;
Yii: Yii: app ()-> request-> userHostAddress;
Yii judgment submission method: Yii: app ()-> request-> isPostRequest
Obtain the current domain name: Yii: app ()-> request-> hostInfo
Obtain the physical path of the proteced Directory: YII: app ()-> basePath;
Get the URL of the previous page to return: yii: APP ()-> request-> urlreferrer;
Obtain the current URL: yii: APP ()-> request-> URL;
Obtain the current home URL: yii: APP ()-> homeurl.
Get the current return URL: yii: APP ()-> User-> returnurl
Project path: dirname (yii: APP ()-> basepath)
I. namespace constants defined by yii framework
System: points to the yii framework directory; yii \ framework
Zii: pointing to the zii library directory; yii \ framework \ zii
Application: points to the basic application directory; protected \
Webroot: Point to includePortal scriptFile directory ;.\
Ext: points to the directory containing all third-party extensions; \ protected \ extensions
Usage: yii: getpathofalias ('webroot ')
II:
{Full URL}: Get the current complete path
Yii: getframeworkpath (): yii framework path
III:
Insert meta information
Yii: app ()-> clientScript-> register1_ag ('keyword', 'keyword '); Yii: app ()-> clientScript-> register1_ag ('description ', 'Some description'); Yii: app ()-> clientScript-> register1_ag ('author', 'author ');
Example:
<Link rel = "alternate" type = "application/rss + xml" href = "http://www.dreamdu.com/feed/"/>
Indicates:
Yii: app ()-> clientScript-> registerLinkTag ('alternet', 'application/rss + xml', $ this-> createUrl ('/feed '));
Add a CSS 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 ');
Obtain the ID method of the current controller in view.
Yii: APP ()-> getcontroller ()-> ID;
Obtain the ID of the current action in the view:
Yii: APP ()-> getcontroller ()-> getaction ()-> ID;
Yii get IP Address
Yii: APP ()-> request-> userhostaddress;
Yii judgment submission method
Yii: APP ()-> request-> ispostrequest
Get the current domain name:
Yii: APP ()-> request-> hostinfo
Obtain the physical path of the proteced directory.
Yii: APP ()-> basepath;
Returns the url of the previous page.
Yii: APP ()-> request-> urlreferrer;
Get the current url
Yii: APP ()-> request-> URL;
Get the current home url
Yii: APP ()-> homeurl
Returns the current return url.
Yii: APP ()-> User-> returnurl
Project path
Dirname (yii: APP ()-> basepath)