在Codeigniter中使用FirePHP进行调试
2012-04-05 15:08
501 查看
本文介绍的方法,力图在使用FirePHP的时候不影响Codeigniter的代码,也就是说以后Codeigniter的升级不会受FirePHP插件的影响。
具体使用步骤如下:
FireBug extension
FirePHP extension
打开Firefox,确认网络面板已经开启。
解压后将文件 FirePHP.class.php 拷贝到 /application/libraries/ 目录,并修改文件名为 firephp.php。
在文件中搜索protected $enabled = true,将其替换为 protected $enabled = ENABLE_IN_CONFIG。
也可以使用group:
更多使用方法参考 FirePHP project website 。
具体使用步骤如下:
1. 下载相关插件
Firefox browserFireBug extension
FirePHP extension
打开Firefox,确认网络面板已经开启。
2. 下载FirePHP Core Library文件
下载地址:http://www.firephp.org/DownloadRelease/FirePHPLibrary-FirePHPCore-0.3.2 (或更新版本)解压后将文件 FirePHP.class.php 拷贝到 /application/libraries/ 目录,并修改文件名为 firephp.php。
3. 设置autoload
修改文件 /application/config/autoload.php,让firephp库自动加载:$autoload['libraries'] = array('firephp');
4. 修改firephp.php文件
在firephp.php文件中类的声明之前(line 60左右)加入如下代码,便于使用config中的设置来打开关闭firephp。$CI = & get_instance(); if($CI->config->item('enable_firephp')) define('ENABLE_IN_CONFIG',true); else define('ENABLE_IN_CONFIG',false);
在文件中搜索protected $enabled = true,将其替换为 protected $enabled = ENABLE_IN_CONFIG。
5. 配置config文件
在application/config/目录下找到config.php,增加如下一行内容:$config['enable_firephp'] = true;
6. 开始使用吧
常用使用方法:$this->firephp->log($myvariable): 在FirePHP控制台打印出变量
$this->firephp->warn($myvariable): 在FirePHP控制台打印出变量并归类为warning
$this->firephp->error($myvariable): 在FirePHP控制台打印出变量并归类为 error
也可以使用group:
$this->firephp->group('Test Group'); $this->firephp->log('Hello World'); $this->firephp->groupEnd();
更多使用方法参考 FirePHP project website 。
相关文章推荐
- PHP在浏览器上跟踪调试的方法以及使用ChromePhp、FirePHP的简单介绍
- zend framework 使用firephp调试(转载自phpchina)
- php使用Xdebug进行调试
- Sublime Text 3 配置 PHP IDE环境 并使用Xdebug进行调试
- 如何在eclipse里面进行PHP代码的调试(使用集成开发环境xampp)
- 使用Firebug和FirePHP调试PHP
- 使用CodeIgniter来调用淘宝SDK数据进行PHP开发
- 使用CodeIgniter来调用淘宝SDK数据进行PHP开发
- php代码调试利器firephp安装与使用方法分析
- 使用xampp和xdebug,加上eclipse-php对程序进行调试
- 使用Firebug和FirePHP调试PHP
- [PHP]使用日志进行调试
- 使用cli(命令行)方式执行php程序进行高效的程序调试
- 如何使用FireFox插件FirePHP调试PHP
- 使用netbeans进行PHP团队开发和基于xdebug进行多人远程调试
- Sublime Text 3 配置 PHP IDE环境 并使用Xdebug进行调试
- vs.php中使用apache或IIS7进行外部调试
- PHP在浏览器上跟踪调试的方法以及使用ChromePhp、FirePHP的简介
- PHP调试工具FirePHP使用方法
- Mac系统下使用自带Apache和php5.6使用xdebug进行调试