Application examples of firephp

Source: Internet
Author: User
Examples of use of firephp
I. What is firephp?

The firephp is a plug-in for the FF that outputs PHP debugging information to the Firebug console.

Two. What's the use of firephp?

After the official release, without affecting the page display, debug PHP, output debugging information to the console


Three. firephp Installation

1. Prerequisite: Plug-in---firebug to install FF
2. Installation:
A. Installing the Firephpcore component on the server side
B. Place the package under the project directory (assuming Firephpcore is placed in the project root)
C. Server-side usage (Import package)
D. Turn on the client
Turn on Firebug console, scripts, network.
Add the current site to firephp allow site

3. Use
Require (' firephpcore/fb.php '); Import Package/* Note:you must have Output buffering enabled via Ob_start () or output_buffering INI directive. *//* Open the output buffer (because firephp mainly uses the header function), there are three ways: * in front of the program plus Ob_start () * Modify PHP.ini output_buffering set to 1 or on* modify Apache settings,  Add Php_flag output_buffering On*/ob_start () to the configuration file;/* Start Debugging: You can debug the output of the following data types: * String, can be divided into log,info,warn,error four kinds of will display a row of results in the console, except for the icons that display different pages already. * Object or array* data returned by SQL query * Exception information thrown by the server (not output in console, but net in */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 message ', Firephp::warn);//==FB (' Warn message ', ' WARN '); FB (' Error message ', firephp::error);//==FB (' Error message ', ' Error ');/*FB function: Parameter one is any value that needs to be displayed (string|array| Integer ...) Parameter two if the type is not, then the label for this row. The example FB (' String ', ' label ', Firephp::log) is displayed in the console as LABEL:STRING*/FB (' Message with label ', ' label ', Firephp::log); FB ( Array (' key1 ' = ' val1 ', ' key2 ' =>array (Array (' v1 ', ' v2 '), ' v3 ')), ' Testarray ', firephp::log), function test ($Arg 1) {throw new Exception (' Test Exception ');}   try {test (' Hello ' = ' World ')} catch (Exception $e) {/* Log Exception including stack trace & variables */ FB ($e);}  /* Firephp::table will display a table in the console. The value of the array subscript 0 for parameter one is the value of the array subscript 1 for the caption parameter one 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 ', ' ro W2 ') (firephp::table)),/*firephp::D UMP Displays the information you want to output under the Server tab of this page under the Net tab. *//* would show only in "Server" tab for the request */FB (Apache_request_headers (), ' Requestheaders ', firephp::D UMP);p rint ' Hello World ';


There is also a need to note that in order to secure the data, in the revision of the bug when the official release, the need to fb::setenabled (false); Debug information will no longer be output to the console
  • 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.