FirePHP application instance + comment

Source: Internet
Author: User
FirePHP instance + comment? I. What is firePHP? firePHP is a ff plug-in used to output php debugging information to the firebug console. II. what does firePHP do after it is officially released without affecting the page display? Debug php and output the debugging information to the controlled FirePHP instance + comment.

?



I. What is firePHP?

FirePHP is a ff plug-in that outputs php debugging information to the firebug console.

II. what is the use of firePHP?

After the official release, Debug php and output the debugging information to the console without affecting the page display.



3. install firePHP

1. Prerequisites: you need to install the ff plug-in-firebug.
2. Installation:
A. install the FirePHPCore component on the server
B. put the package under the Project Directory (assuming that firePHPCore is placed under the Project root directory)
C. server usage (import package)
D. enable the client
Enable the Firebug console, script, and network.
Add the current website to the FirePHP site

3. use

Require ('firephpcore/fb. php '); // Import package/* NOTE: You must have Output Buffering enabled via ob_start () or output_buffering ini directive. * // * enable the output buffer (because Firephp mainly uses the header function). There are three methods: * add ob_start () * before the program to modify php. ini sets output_buffering to 1 or on * to modify apache settings. in the configuration file, add php_flag output_buffering on */ob_start ();/* to start debugging: you can debug and output the following data types: * string, which can be divided into four types: LOG, INFO, WARN, and ERROR. a row of results will be displayed on the console, except that different pages of icons are displayed. * Object or Array * Data returned by SQL query * thrown exception information * information returned by the server (not output in the console, but in NET */fb ('Hello World');/* Defaults to FirePHP:: LOG */fb ('log message', FirePHP: Log); // = fb ('log message', 'log '); = fb ('log message'); fb ('info message', FirePHP: Info); // = fb ('info message', 'info '); fb ('warn', FirePHP: Warn); // = fb ('warn', 'warn'); fb ('error message', FirePHP :: ERROR); // = fb ('error message', 'error');/* fb function: parameter 1: any value to be displayed (st Ring | array | integer ...) If parameter 2 is not a type, it is the label of this line. For example, fb ('string', 'label', FirePHP: LOG) is displayed as label: string */fb ('message with label', 'label ', firePHP: LOG); fb (array ('key1' => 'val1', 'key2' => array ('v1 ', 'V2 '), 'v3 '), 'testarray', FirePHP: LOG); function test ($ Arg1) {throw new Exception ('test exception ');} try {test (array ('Hello' => 'world');} catch (Exception $ e) {/* Log exception including stack trace & variables */fb ($ e);}/* FirePHP: TABLE will A table is displayed on the console. the value of array subscript 0 of parameter 1 is the information of the row to be displayed. The value of array subscript 1 of parameter 1 of the title to be displayed */fb (array ('2 SQL queries took 0.06 seconds ', array ('SQL Statement', 'time', 'result'), array ('select * FROM Foo', '0. 02 ', array ('row1', 'row2'), array ('select * FROM bar', '0. 04 ', array ('row1', 'row2'), FirePHP: TABLE);/* FirePHP :: DUMP will display the information you want to output under the Server tag requested on this page under the NET tag. * // * Will show only in "Server" tab for the request */fb (apache_request_headers (), 'requestheaders', FirePHP: DUMP); print 'Hello World ';




Note that for data security, FB: setEnabled (false) is required when the bug is officially released. debugging information will not be output to the console.

References: http://blog.csdn.net/john_shen_tiro1/archive/2009/04/14/4071212.aspx
Http://blog.csdn.net/leijuly/archive/2009/05/31/4227613.aspx

?

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.