ThinkPHP learning notes (2) functions of portal files, URL control, and simple use of templates admin. php & lt ;? Phpini_set (& quot; session. save_handler & quot;, & quot; files & quot;); // ThinkPHP core framework file path // second meaning: ThinkPHP study notes (2) functions of entry files, URL control, and simple use of templates
Admin. php
IndexAction. php
Assign ("content", "the monk goes down the hill to save the Zhai, the old monk has an explanation"); $ this-> display (); // 1. specify a new template under the same level // $ this-> display ("newTemplate"); // 2. cross-controller reference template (you can also add group information) // $ this-> display ("Group: User: verify"); // 3. cross-skin reference // $ this-> display ("test @ User: verify"); // 4. full path output (create a public folder in the directory at the same level of the project) // The location where the file is loaded is located in the main portal file. // $ this-> display (". /public/ss.html "); // display parameter // $ this-> display (" location "," UTF-8 "," text/xml ") ;}}?>
Conf/config. php
'Configuration value' // because the URL is enabled again, whether it is overwritten or not, it can be accessed through the original path. // If you want to enable the rewrite mode, perform the following operations // 1. the query server has enabled the Apache rewrite module // LoadModule rewrite_module modules/mod_rewrite.so // 2. create a new one under the statistics Directory of the master Portal file. htaccess (vi: save. htaccess; notepad :". htaccess ") // If you select mode 2 (rewrite), the server will consume more 'URL _ model' => 1, 'URL _ PATNINFO_MODEL '=> 2, // pathinfo contains two classes // 1 Normal mode: m and a: The order relationship can change // http: // localhost/MyThinkPHP/admin. php/m/index/a/index // pass the value // http: // localhost/MyThinkPHP/admin. php/m/index/a/index/username/zhangsan/password // 2 intelligent identification module operation (intelligent identification is the default mode) // http: // localhost/MyThinkPHP/admin. php/index // pass the value // http: // localhost/MyThinkPHP/admin. php/index/username/zhangsan/password // modify the URL separator // 'URL _ pathinfo_depr' => '-', // modify the left and right delimers of the template 'tmpl _ L_DELIM '=>'
', // Enable the debugging mode // 1. simulate a linux system to identify the case. // 2. the case sensitivity of the method name is related to the case sensitivity of the template file 'app _ debug' => true,);?>
. Htaccess
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]