Thinkphp Learning Notes (iv) debug mode and Logging
Underneath the ornate split line is a concrete implementation that needs to be modified and can be configured:
cong.php
' Config value '//Because the open URL is re-rewritten or not rewritten, can be accessed through the original path//If you want to turn on rewrite mode, you need to do the following//1.query server has opened Apache rewrite module// LoadModule Rewrite_module MODULES/MOD_REWRITE.SO//2. In the statistics directory with the main entry file, create a new. htaccess (Vi:save. htaccess; Notepad: ". htaccess" )//If Select mode 2 (rewrite) will increase the consumption of the server ' Url_model ' =>1, ' Url_patninfo_model ' =>2,//pathinfo contains two types of//1 common mode: Plus M and a: sequence relationships can change//http://localhost/mythinkphp/admin.php/m/index/a/index//values//http://localhost/mythinkphp/ ADMIN.PHP/M/INDEX/A/INDEX/USERNAME/ZHANGSAN/PASSWORD/PASSWORD//2 Intelligent Identification Module operation (the default mode is smart identification)//http://localhost/ mythinkphp/admin.php/index/index//Transfer Value//http://localhost/mythinkphp/admin.php/index/index/username/zhangsan/ password/password//Modify URL delimiter//' url_pathinfo_depr ' = '-',//modify template left and right delimiters ' tmpl_l_delim ' = '
',//******************************** very gorgeous split line **************************************//turn on debug mode//1. Simulate a Linux system to identify case/ /2. The case of the method name is related to the template file case, the ' app_debug ' =>true,//can customize the page's trace information//configuration file path trace information configured under THINKPHP/TPL pagetrace.tpl.php// Custom mode://' Tmpl_trace_file ' =>app_path. ' /public/trace.php ',//or custom trace.php page into the current Conf folder//The location of the default debug file://thinkphp/common/debug.php//do not cache database fields; Re-modify can be runtim/data the following file to delete//' db_fields_cache ' = false,//can be customized debug.php into the current Conf folder//First App_ DEBUG is set to False then add the following parameter//' App_debug ' =>false,//to show the time required to run this page//' Show_run_time ' =>true,//show verbose run time (based on Show_run _time)//' Show_adv_time ' =>true,//shows the number of operations of the database (based on show_run_time)//' Show_db_times ' =>true,//shows the number of operations cached (based on Show_ run_time)//' Show_cache_times ' =>true,//display memory overhead (based on show_run_time)//' Show_use_mem ' =>true,//setup template//' Default_ THEME ' + ' default ',//log processing Log class: lib/think/core/log.class.php//open log ' Log_record ' =>true,//log Processing logs class: lib/think/ Core/log.class.php has the processing level, can selectively join ' log_record_level ' =>array (' Emerg ', ' ALERT '),); >
To use in action:
Model debugging (the action statement executed in the database) $User =new model (' User '), $User->find (1);//Gets the last executed Sqlecho $User->getlastsql ();//Use: Log information , log level, log type, specific information log::write ("AA", $level, $type, $file);//record method writes information to memory