Use firephp for debugging in codeigniter

Source: Internet
Author: User
Tags autoload codeigniter

The method described in this article tries not to affect codeigniter'sCodeIn other words, codeigniter upgrade will not be affected by the firephp plug-in the future.

The procedure is as follows:

1. Download related plug-ins
    • Firefox browser
    • Firebug Extension
    • Firephp Extension

Open Firefox and check that the network panel is enabled.

2. Download The firephp core library file

: Http://www.firephp.org/DownloadRelease/FirePHPLibrary-FirePHPCore-0.3.2 (or updated version)

Decompress the package, copy the file firephp. Class. php to the/application/libraries/directory, and change the file name to firephp. php.

3. Set autoload

Modify the file/application/config/autoload. php to enable the firephp library to automatically load the file:

 
$ Autoload ['libraries'] = array ('firephp ');
4. Modify the firephp. php file

Before the class declaration in the firephp. php file (line 60 or so), add the following code to enable and disable firephp using the settings in config.

$ CI = & get_instance (); if ($ ci-> config-> item ('Enable _ firephp') define ('Enable _ in_config ', true ); elsedefine ('Enable _ in_config ', false );

Search for filesProtected $ enabled = true, Replace itProtected $ enabled = enable_in_config.

5. Configure the config file

Find config. php In the application/config/directory and add the following line:

 
$ Config ['Enable _ firephp'] = true;
6. start using it.

Common usage:

    • $ This-> firephp-> log ($ myvariable): Print the variable in the firephp Console
    • $ This-> firephp-> warn ($ myvariable): Print the variables in the firephp console and classify them as warning.
    • $ This-> firephp-> error ($ myvariable): Print the variables in the firephp console and classify them as error.

You can also use group:

$ This-> firephp-> group ('test group'); $ this-> firephp-> log ('Hello World '); $ this-> firephp-> groupend ();

For more instructions, see firephp project website.

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.