PHP on the browser to track debugging methods and the use of chromephp, firephp simple Introduction

Source: Internet
Author: User

Before using thinkphp found a trace function can track debugging, feel very interesting, online search for the next similar things, found the chromephp, did not think of this to debug PHP program, feel very convenient, very useful.

thinkphp use of their own generated HTML with the template output to display, occasionally encounter some inexplicable problems, the effect is not too good,

There are some similar methods, but the main output is to add JS code in the template, call the browser debugging method for output debugging

such as Console.log (' Some debug output content of PHP ');


Chromephp is through the header to transfer debugging content and through the installation of Chrome browser plugin to read the header information displayed in the browser debug panel to view, the function is more powerful, there is not much interference on the page, debugging is more convenient, Firefox is said to have similar firephp , but I don't know how to use Firefox to test it now.


Website address:

http://www.chromelogger.com/


This is the Github address for the Open source project:

github:https://github.com/ccampbell/chromephp


This is the installation address of the Chrome kernel browser plugin:

Https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd

But always by the wall, not open, and can only be Google Chrome to install, I found long time only found a 3.0 plug-in

Plug - ins:

http://download.csdn.net/detail/zsjangel/7535201

Can be installed after try to upgrade to the latest 4.1, I was so successful


The 3.0 plugin icon is not the same as 4.1:




The following is the 4.1 version, Black is indicated as the open plugin, click Start




Blue on the bottom indicates start, debugging information can be seen in the panel





How to use PHP:

Chromephp::log (' Hello console! '); Chromephp::group (' This is group '); Chromephp::log (' Hi God's snail! '); Chromephp::error (' something went wrong! '); Chromephp::groupend (); Chromephp::table (Array (' AA ' = ' BB ', ' cc ' =>11), array (' aa ' = ' = ' cc ', ' cc ' =>22));


Group means that the default direct expansion of all the following is a set of debugging information, until the end of GroupEnd, the display effect and normal log is not the same


Default shrinkage does not show entire group information if using groupcollapsed


Table parameter must be a two-dimensional array, otherwise it will not be displayed, the key name of the array and the field name


Here are the following:





--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------


Just try Firefox under the firephp plug-in, their functions are very similar, but firephp than chromephp more popular, will not be wall installation is convenient, the latter of the GitHub project seems a year without maintenance updates, it may be nothing to update it, but FIR Efox and Chrome Browser, the latter should use more people.


Firephp Official homepage: (Download PHP end Class library)

Http://www.firephp.org/HQ/Install.htm


Install plug-ins Needless to say, add-ons inside the search under firephp is convenient, must rely on FireBug, it is best to install FireBug and then install firephp





PHP Simple test Code:

$fire = Firephp::init (); $fire->log (' Hello console! '); /Collapsed:true The set of debug information $fire->group (' This is group ', Array (' collapsed ' =>true)); $fire->log (' Hi God's snail! '); $fire->error (' something went wrong! '); $fire->groupend (); $fire->table (' Data table ', Array (' AA ' = ' BB ', ' cc ' =>11), array (' AA ' = ' cc ', ' cc ' = (>22)));


Effect:




They all have the same principle, basically the same way, and that's about it.

Finally, one more header. Transmission Debug Confidence Comparison:






Firephp in the output should be judged the current browser, non-Firefox will not output header information, and chromephp is not judged to be direct output




--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------

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.