Hink PHP provides a page debug scenario, Trace.
Using this debug scenario, you only need to use the following sentence in the configuration file:
' Show_page_trace ' =>true
The effect is as follows:
In the bottom right corner of each page, there will be a button that you can open:
There are a lot of page information in it.
Specifically, you can configure what information is available on your own, by:
1' Trace_page_tabs ' =Array(2' Base ' = ' basic ',3' File ' = ' files ',4' Think ' = ' process ',5' Error ' = ' wrong ',6' SQL ' = ' sql ',7' Debug ' = ' Commissioning ',8' User ' = ' users '9 )TenOr One' Trace_page_tabs ' =Array( A' Base ' = ' basic ', -' File ' = ' files ', -' Think ' = ' process ', the' Error|debug|sql ' = ' Debug ', -' User ' = ' users ' -)
As you can see, in the debug information above, the user is not shown in the actual page, that is the custom debugging information, using the method is: You can use the trace function in any program you call
1 Trace ($user, ' User information ', ' users '); 2 Trace ("Cheng Yu", "Handsome Man", "user");
By default, trace information is not saved, but you can use the following configuration item to save the trace information:
' Page_trace_save ' =>true
After the page trace information is saved, each page trace information is saved to the log directory of the project, and the naming format is:
Current date _trace.log
If you only want to save some trace information, you can use a configuration similar to the following:
' Page_trace_save ' = = Array (' base ', ' file ', ' SQL ');
The trace function has four parameters, which gives the source code for the trace function:
1 function Trace ($value= ' [think] ',$label= ',$level= ' DEBUG ',$record= false ) {2 return think\think::trace ($value,$label,$level ,$record); 3 }
Based on the trace scheme above, you can do a lot of power-off debugging. In addition, think PHP provides another efficient debugging scheme similar to PHP inside the var_dump and Print_r called the dump function, using this function can be used to print the variable at the bottom of the page.
You can do a lot of things based on the dump function, for example, you can print out all of the page's exception information:
1 Dump (E (' Error '));
The effect of the above code is:
In addition, there is a scenario called model debugging, similar to the exception that was thrown before the capture in Java, but slightly different.
thinkphp Debug Solution