Learning frontend: thinkPHP Study Notes (2) and thinkphp Study Notes
1. debugging mode
The code for setting the debugging mode is as follows:
1 <? Php2 define ('app _ debug', TRUE); // enable the DEBUG mode constant definition code 3 require '/ThinkPHP framework directory/ThinkPHP. php ';
The code for disabling the debug mode is as follows:
define('APP_DEBUG',false);
2. Configuration
1 // project configuration file 2 return array (3 'configuration parameter' => 'configuration value', 4 // more configuration parameters 5 //... 6 );
3. Controller
The Code is as follows:
1 class IndexAction extends Action {// The class name here must be consistent with the file name 2 public function index () {3 echo 'hello, world! '; 4} 5}
4. URL
There are also some small points to add:
(1) m parameter indicates module, and a operation indicates operation
(2) In PATHINFO mode, URLs are customizable.
1 'url _ pathinfo_depr' => '-', // change the PATHINFO parameter delimiter
The following URLs are supported:
http://localhost/app/index.php/module-action-var-value/
(3)REWRITE Mode: Add the following code:
<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>