Thinkphp Learning Notes (iv) debug mode and Logging ____php

Source: Internet
Author: User

Underneath the gorgeous split line is the specific implementation that needs to be modified and configurable:

cong.php

<?php return Array (//replacement mode) It is best to remove some ~app.php and ~runtime.php//' Configuration Items ' => ' configuration values '//Since the open URL, whether rewritten or not rewritten, can be accessed via the original path// If you want to turn on rewrite mode, you need to do the following//1.query the server has opened the Apache rewrite module//LoadModule rewrite_module modules/mod_rewrite.so. In with the main entry file, under the statistics directory, create a new. htaccess (Vi:save. htaccess notepad: ". htaccess")//If Option mode 2 (rewrite) increases server consumption ' Url_model ' =>1, ' URL _patninfo_model ' =>2,//pathinfo contains two types of//1 common patterns: plus M and a: Sequential relationships can change//http://localhost/mythinkphp/admin.php/m/index/a /index//Transfer value//http://localhost/mythinkphp/admin.php/m/index/a/index/username/zhangsan/password/password// 2 Intelligent Recognition Module operation (the default mode is intelligent recognition)//http://localhost/mythinkphp/admin.php/index/index//value//http://localhost/mythinkphp/ Admin.php/index/index/username/zhangsan/password/password//Modify URL separator//' URL_PATHINFO_DEPR ' => '-',//modify template left-right delimiter ' Tmpl_l_delim ' => ' <!--{', ' tmpl_r_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 case of the template file ' App_dEbug ' =>true,//can customize the trace information//profile path of the page The trace information is configured under THINKPHP/TPL pageTrace.tpl.php//Custom way://' tmpl_trace_file ' = >app_path. ' /public/trace.php ',//or customize the trace.php page into the current Conf folder//default Debug File Location://thinkphp/common/debug.php//Do not cache database fields; Re-modify the files below Runtim/data can be deleted//' Db_fields_cache ' => false,//can be customized debug.php into the current Conf folder//First App_ DEBUG is set to false and then add the following parameter//' App_debug ' =>false,//show the time required to run this page/' Show_run_time ' =>true,//Show detailed elapsed time (based on Show_run _time)//' Show_adv_time ' =>true,//Displays the number of operations (based on Show_run_time)//' Show_db_times ' =>true,//shows 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,//Setup template//' Default_ THEME ' => ' default ',//log processing Log class: lib/think/core/log.class.php//Open log ' Log_record ' =>true,//Log processing log class: lib/think/ There are processing levels in the core/log.class.php, optionally joining ' Log_record_level ' =>array (' Emerg ', ' ALERT '),?>

To use in action:

        
Model debugging (The operation statement executed in the database)
$User =new model (' User ');
$User->find (1);
Gets the last executed SQL
echo $User->getlastsql ();

Usage: Log information, log level, log type, specific information
log::write ("AA", $level, $type, $file);
The record method writes information to memory
        
        


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.