Yii Framework website resolution

Source: Internet
Author: User
First, if you do not configure urlManager in configmainphp, the process is as follows (from the yii official website). The user sent an access URL http: wwwexamplecomindexphp? R = postshow & amp; id = 1. the Web server executes the indexp script by running the indexp script. php does not configure urlManager, then the process is as follows (from the yii official website) the user issued a URL http://www.example.com/index.php? R = post/show & id = 1. the Web server processes this request by executing the entry script index. php. The portal script creates an application instance and runs it. An application obtains the details of a user request from an application component called request. With the help of an application component called urlManager, an application determines the request controller and action. In this example, the controller is post, which represents the PostController class; the action is show, and its actual meaning is determined by the controller. The application creates an instance of the requested controller to further process user requests. The controller determines that action show points to an actionShow method in the controller class. Then it creates and carries the filters associated with the action (such as access control and benchmark testing ). If the filter permits, the action is executed. Action reads a Post model with ID 1 from the database. The action uses the Post model to render a view named show. The View reads and displays the attributes of the Post model. The view executes some small objects. The rendering result of the view is inserted into a layout. The action completes the rendering of the view and presents it to the user. However, if you have configured urlManager as follows: 'urlmanager' => array ('urlformat' => 'path', 'rules' => array (' / '=>' /Index ',' /'=>' /',' // '=>' /',),), Then access the http://www.example.com/index.php directly? R = post/show & id = 1 cannot get the show action result. First, the request will be sent to the indexAction of defacontroller controller. defacontroller controller is set in main. php. if defacontroller controller is not PostControler, you may be confused. If yes, the content of indexAction is returned instead of showAction. In fact to access this is also very simple, http://www.example.com/index.php/post/show? Id = 1, because urlManager has been set /Format

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.