from:http://www.phpjc.cn/ajax/2009/1013/20.html
服务端使用方式。
a、引入代码
require_once ( 'FirePHPCore/FirePHP.class.php' ) ;
b、开启客户端
开启Firebug 控制台、脚本、网络。
将当前网站添加入FirePHP允许站点(十分容易自己熟悉一下就知道了)。
c、服务器端使用
1.引用文件
require_once ( 'FirePHPCore/FirePHP.class.php' ) ;
2.创建对象
$firephp = FirePHP:: getInstance ( true ) ;
3.使用函数
$firephp -> *
4.函数及功能:
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);
// 在异常处理中使用FirePHP
class 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();
}