Common yii URLs and IP addresses

Source: Internet
Author: User

Current page: yii: APP ()-> request-> URL;
Jump to 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 ();

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 );
Current Domain Name: yii: APP ()-> request-> hostinfo;
Except the Domain Name: yii: APP ()-> request-> geturl ();
Homepage Address except Domain Name: yii: APP ()-> User-> returnurl;
Root directory address except Domain Name: yii: APP ()-> homeurl;

Yii: APP ()-> request-> userhostaddress;
Yii judgment submission method: yii: APP ()-> request-ispostrequest;
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 controller ID: yii: APP ()-> getcontroller ()-> getaction ()-> ID;
Project path: dirname (yii: APP ()-> basepath );
Yii obtains get and post data: yii: APP ()-> request-> getparam ('id ');

How to set the time zone for yii:
You can set the time zone in 'timezone '=> 'Asia/chongqing' in config/Main. php.

How does yii make the Form Verification prompt Chinese:
Add language => 'zh _ Cn 'to the app configuration in Main. php. The system prompts Chinese by default.

Prevent repeated submission: ccontroler-> refresh ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.