1. in config. set in php. the default value is off. & amp; #39; APP_DEBUG & amp; #39; & gt; true. enable \ ThinkPHP \ Common \ debug. php file to view the default debug...
1. in config. set in php, the default is off, 'app _ debug' => true, open \ ThinkPHP \ Common \ DEBUG. you can view the default settings of debug in the PHP file as follows:
- Return array (
- 'Log _ RECORD '=> true, // logs
-
- 'Log _ RECORD_LEVEL '=> array ('emerg', 'Alert ', 'crit', 'err', 'warn', 'notic', 'info ', 'debug', 'SQL'), // The log level that can be recorded
- 'Db _ FIELDS_CACHE '=> false, // cache database fields
- 'Show _ RUN_TIME '=> true, // Run time display
- 'Show _ adv_time' => true, // displays the detailed running time.
- 'Show _ DB_TIMES '=> true, // displays the number of database queries and writes.
- 'Show _ CACHE_TIMES '=> true, // displays the number of cache operations
- 'Show _ USE_MEM '=> true, // display memory overhead
- 'Show _ PAGE_TRACE '=> true, // The Trace information of the displayed page is assigned by the Trace file definition and Action operation.
- 'App _ FILE_CASE '=> true, // check whether the file is case-sensitive for Windows platforms
- );
Note:DB_FIELDS_CACHE the database field cache is disabled by default. if it is enabled, the file cache will be generated in the Runtime \ Data folder, and the new field is added after the table is modified, this cache cannot record your operations. you need to manually delete the table once before modification.
After 'app _ debug' => true, the following DEBUG prompt appears when you access the page:
If you only want to display a part of the prompt information, such as the running time and memory overhead, you can set it in config. php, for example:
- // 'App _ debug' => true, // DEBUG mode switch
- 'Show _ RUN_TIME '=> true, // Run time display
- 'Show _ adv_time' => true, // displays the detailed running time.
- 'Show _ DB_TIMES '=> true, // displays the number of database operations
- 'Show _ CACHE_TIMES '=> true, // displays the number of cache operations
- 'Show _ USE_MEM '=> true, // display memory overhead
The prompt information is as follows:
2. Custom page Trace information: \ ThinkPHP \ Tpl \ PageTrace. tpl. php
Custom Method 1: Add a trace. php file to the same directory of config. php.
- Return array {
- 'Current server information' =>$ _ SERVER ['remote _ ADDR '],
- };
- ?>
Custom Method 2: Add
$ This-> trace ('I am ugly, but I am gentle,' 100 ');
3. output debugging method:
Halt ('aaaaaaa'); // output aaaaaa and interrupt program execution
4. model debugging: displays SQL statements.
- $ User = new Model ('user ');
- $ User-> find (1 );
- Echo $ User-> getLastSql (); // output the last SQL statement executed
5. set \ ThinkPHP \ Lib \ Think \ Core \ Log. class. php and config. php as follows:
- 'Log _ RECORD '=> true, // logging enabled
- 'Log _ RECORD_LEVEL '=> array ('error', 'Alert', 'error '),