ThinkPHP learning notes debugging mode and logging _ PHP Tutorial

Source: Internet
Author: User
ThinkPHP learning notes debugging mode and logging. Under the gorgeous split line, you need to modify and configure the specific implementation method: cong. php [php]? Phpreturnarray ~ App. php and ~ The runtime. php configuration under the gorgeous split line is the specific implementation method that needs to be modified and can be configured:

Cong. php

[Php]

Return array (

// It is recommended to delete some items in the change mode ~ App. php and ~ Runtime. php

// 'Config maps '=> 'configuration value'

// Because the URL can be accessed through the original path, whether it is rewritten or not overwritten.

// To enable 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. htaccess (vi: save. htaccess; notepad: ". htaccess") under the statistics Directory of the master Portal file ")

// If Mode 2 (rewrite) is selected, the server consumption will be increased.

'URL _ model' => 1,

'URL _ PATNINFO_MODEL '=> 2,

// Pathinfo contains two types

// 1 Normal mode: plus 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 recognition module operation (the default mode is intelligent recognition)

// 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 delimiters of the template

'Tmpl _ L_DELIM '=>' ',

// ************************************ Very gorgeous split line ** ************************************

// Enable the debugging mode

// 1. simulate a linux system to identify case sensitivity

// 2. the case sensitivity of the method name is related to the case sensitivity of the template file.

'App _ debug' => true,

// You can customize the Trace information of a page.

// Configure the Trace information of the configuration file path in pageTrace. Tpl. php under Thinkphp/tpl

// Custom mode:

// 'Tmpl _ TRACE_FILE '=> APP_PATH.'/Public/trace. php ',

// Or add a custom trace. php page to the current Conf folder.

// Default debugging file location:

// ThinkPHP/Common/debug. php

// Do not cache database fields. If enabled, you can delete the files under Runtim/Data.

// 'DB _ FIELDS_CACHE '=> false,

// Add the customizable debug. php file to the current Conf folder.

// Set APP_DEBUG to false and add the following parameters

// 'App _ debug' => false,

// Display the time required for running this page

// 'Show _ RUN_TIME '=> true,

// Display the detailed running time (based on SHOW_RUN_TIME)

// 'Show _ ADV_TIME '=> true,

// Display the number of database operations (based on SHOW_RUN_TIME)

// 'Show _ DB_TIMES '=> true,

// Display the number of cached operations (based on SHOW_RUN_TIME)

// 'Show _ CACHE_TIMES '=> true,

// Display memory overhead (based on SHOW_RUN_TIME)

// 'Show _ USE_MEM '=> true,

// Set the template

// 'Default _ THEME '=> 'default ',

// Log processing log class: lib/Think/Core/log. class. php

// Enable log

'Log _ RECORD '=> true,

// Log processing log class: there is a processing level in lib/Think/Core/log. class. php and can be added selectively

'Log _ RECORD_LEVEL '=> array ('error', 'Alert '),

);

?>

Use in action:

[Php]

// Model debugging (Operation statements executed in the database)

$ User = new Model ('user ');

$ User-> find (1 );

// Obtain the last SQL statement executed

Echo $ User-> getLastSql ();

// Use: log information, log level, log type, and specific information

Log: write ("aa", $ level, $ type, $ file );

// The record method writes information to the memory.

Why cong. php [php]? Php return array (// it is best to delete some ~ App. php and ~ Runtime. php // configuration...

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.