Home >Backend Development >PHP Tutorial >ThinkPHP study notes debugging mode and logging_PHP tutorial

ThinkPHP study notes debugging mode and logging_PHP tutorial

WBOY
WBOYOriginal
2016-07-14 10:08:07759browse

Under the gorgeous dividing line are the specific implementation methods that need to be modified and configured:

cong.php
[php]
return array(
//When changing the mode, it is best to delete some ~app.php and ~runtime.php
//'Configuration item'=>'Configuration value'
//Because after opening the URL again, whether it is rewritten or not, it can be accessed through the original path
//If you want to enable rewrite mode, you need to do the following
//1. The query server has enabled Apache’s rewrite module
// LoadModule rewrite_module modules/mod_rewrite.so
//2. Create a new .htaccess (vi:save .htaccess; Notepad: ".htaccess") in the main entry file and statistics directory
//If you choose mode 2 (rewrite), it will increase server consumption
'URL_MODEL'=>1,
'URL_PATNINFO_MODEL'=>2,
//pathinfo contains two categories
//1Normal mode: Add m and a: the order relationship can change
//http://localhost/MyThinkPHP/admin.php/m/index/a/index
//Pass value
//http://localhost/MyThinkPHP/admin.php/m/index/a/index/username/zhangsan/password/password
//2 Intelligent identification module operation (the default mode is intelligent identification)
//http://localhost/MyThinkPHP/admin.php/index/index
//Pass value
//http://localhost/MyThinkPHP/admin.php/index/index/username/zhangsan/password/password
//Modify URL delimiter
//'URL_PATHINFO_DEPR'=>'-',
//Modify the left and right delimiters of the template
'TMPL_L_DELIM'=>'',
//**********************************Very gorgeous dividing line************ ****************************
//Enable debugging mode
///1. Simulate linux system to identify upper and lower case
//2. The case of the method name is related to the case of the template file
'APP_DEBUG'=>true,
//You can customize the Trace information of the page
//The Trace information of the configuration file path is configured in pageTrace.tpl.php under Thinkphp/Tpl
//Customization method:
//'TMPL_TRACE_FILE'=>APP_PATH.'/Public/trace.php',
//Or customize a trace.php page and put it in the current Conf folder
//The location of the default debug file:
//ThinkPHP/Common/debug.php
//Do not cache database fields; if enabled, you can delete the files under Runtim/Data if you modify it
//'DB_FIELDS_CACHE'=> false,
//You can put the customized debug.php into the current Conf folder
//Set APP_DEBUG to false first and then add the following parameters
//'APP_DEBUG'=>false,
//Display the time required to run this page
//'SHOW_RUN_TIME'=>true,
//Show 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,
//Show 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 template
//'DEFAULT_THEME'=>'default',
//Log processing log class: lib/Think/Core/log.class.php
//Open log
'LOG_RECORD'=>true,
//Log processing log class: There are processing levels in lib/Think/Core/log.class.php, which can be optionally added
'LOG_RECORD_LEVEL'=>array('EMERG','ALERT'),
);
?>
Use in action:
[php]
//Model debugging (operation statements executed in the database)
$User=new Model('User');
$User->find(1);
//Get the last executed sql
echo $User->getLastSql();
//Usage: log information, log level, log type, specific information
Log::write("aa",$level,$type,$file);
//record method writes information into memory

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477803.htmlTechArticleUnder the gorgeous dividing line is the specific implementation method that needs to be modified and configured: cong.php [php ] ?php return array( //When changing the mode, it is best to delete some ~app.php and ~runtime.php //With...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn