Learning frontend: thinkPHP Study Notes (2) and thinkphp Study Notes

Source: Internet
Author: User

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>

 

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.