Home > Backend Development > PHP Tutorial > 利用firephp调试php项目

利用firephp调试php项目

WBOY
Release: 2016-06-23 13:42:36
Original
783 people have browsed it

前段时间在写一个项目一个基类5000多行,调试起来简直吐血。

穷则思思则变呀,最后在网上找到了一个调试PHP项目的好方法。感谢前辈的奉献!



客户端:

1.安装了Firebug。
Firebug:https://addons.mozilla.org/zh-CN/firefox/addon/1843
2.安装FirePHP插件。
FirePHP:https://addons.mozilla.org/zh-CN/firefox/addon/6149


服务器端文件下载地址: http://www.firephp.org/DownloadR ... y-FirePHPCore-0.2.1
  a、引入代码

1 require_once('FirePHPCore/fb.php'); // 建议引入此文件即可。文件目录自行安排。使用pear方式安装也是这样引入。
范例:

<?phpinclude_once ('FirePHP/fb.php');FB::log('Hello World !'); // 常规记录FB::group('Test Group A'); // 记录分组// 以下为按照不同类别或者类型进行信息记录FB::log('Plain Message');FB::info('Info Message');FB::warn('Warn Message');FB::error('Error Message');FB::log('Message','Optional Label');FB::groupEnd();FB::group('Test Group B');FB::log('Hello World B');FB::log('Plain Message');FB::info('Info Message');FB::warn('Warn Message');FB::error('Error Message');FB::log('Message','Optional Label');FB::groupEnd();// 将信息作为table输出$table[] = array('Col 1 Heading','Col 2 Heading','Col 2 Heading');$table[] = array('Row 1 Col 1','Row 1 Col 2','Row 1 Col 2');$table[] = array('Row 2 Col 1','Row 2 Col 2');$table[] = array('Row 3 Col 1','Row 3 Col 2');FB::table('Table Label', $table);// 在异常处理中使用FirePHPclass MyException extends Exception{    public function  __construct($message, $code) {        parent::__construct($message, $code);    }    public function log(){        FB::log($this->getMessage());    }}try{    echo 'MoXie';    throw new MyException('some description',1);}catch(MyException $e){    $e->log();}?>
Copy after login
效果图



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template