Relationship between path access mode and Module Access Controller

Source: Internet
Author: User
Today I learned about the tp url access mode, which supports various access modes. It is really powerful.
<? Phpreturn array (// 'config map '=> 'configuration value' 'app _ debug' => true, // once the DEBUG mode is enabled, he will simulate the linux operating system to help us identify the case, the size of the method name is case-sensitive in the template file name. // module = controller // action = method // make changes to the four path access modes in the // conf directory // 0 normal mode (the get mode itself) // 1 path_info mode/index. php/Module (m)/action (a) // 2 rewrite (pseudo static) You can write rewrite rules by yourself, you can also use the features provided by the system to increase the server performance consumption. For more information, see // 3 compatibility mode advantages: the server does not support path_info, however, all previous access modes use the path_info mode. You can use this mode to solve 'url _ model' => 1, // The path_info mode is described below, the setting method is 'url _ model' => 1. There are two common modes: 1 and 2. // Normal Mode : You must add/m/module/a/Action (method) to the front, and the sequence can be changed. If you want to get the value,/name/value // common mode example: 'url _ PATHINFO_MODEL '=> 1, // http: // localhost/TP/index. php/m/index/a/io/get1/value1/get2/value2 // smart mode: default mode, the commonly used/module/method get value is the same as the normal mode 'url _ PATHINFO_MODEL '=> 2, // http: // localhost/TP/index. php/index/io/get1/value1/get2/value2 // you can also change the delimiter. The default value is '/', // 'url _ PATHINFO_DEPR '=>'-'// http: // localhost/TP/index. php/index-io-get1-value1-get2-value2);?>

<? Phpclass UserAction extends Action {// tpl/default/is the default template storage location. A controller needs to create a new folder // it must be in the Tpl directory of the corresponding project, find the default (default skin), and create a new name and Control name (without Action) for the same file index, an Index directory should be created. For the User directory, a User directory should be created. Then, a file with the same method should be created and put under this directory, to call the index function, you must create an index file function index () {$ this-> display (); // call the template to check the corresponding index.html} function io () {// $ this-> assign ('name', 'value'); // The first parameter is the name, and the second parameter is the value. // $ this-> display (); // call io.html to output the parameter with the separator {$ name} In io.html. // if you do not want to display io.html Display other files in the same directory // $ this-> display ('s '); // direct file name, no suffix // cross-controller call // $ this-> display ('index: D'); // controller Name: file Name // cross-skin call // $ this-> display ('skin @ Tem: A'); // skin name @ controller Name: file Name // full path call // the location of the file to be loaded is all located in the main entry file $ this-> display ('. /Public/B .html '); // display ('specify location', 'encoding (UTF-8) ', 'file type (text/xml)') }}?>

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.