firePHP 小试

环境:

Firefox 浏览器

firebug

1.安装firephp 直接在Firefox 附加组件中搜索frephp 然后安装,重启浏览器。

2.下载FirePHPcore libariry     http://www.firephp.org/HQ/Install.htm

3.引入

require_once('FirePHP/fb.php');//引入

fb('Hello World'); /* Defaults to FirePHP::LOG */
fb('Log message'  ,FirePHP::LOG);
fb('Info message' ,FirePHP::INFO);
fb('Warn message' ,FirePHP::WARN);
fb('Error message',FirePHP::ERROR);

<?php
/**
 * 
 * @authors hanguang (hg0728@qq.com)
 * @date    2015-05-08 13:34:10
 * @version 1.0
 */
header("Content-type:text/html;charset=utf-8");
require_once('FirePHP/FirePHP.class.php');
$firephp = FirePHP::getInstance(true);
$firephp->setEnabled(true);//false 不显示,true 显示


require_once('FirePHP/fb.php');
echo 'FirePHP测试';

fb('Hello World'); /* Defaults to FirePHP::LOG */
 
fb('Log message'  ,FirePHP::LOG);
fb('Info message' ,FirePHP::INFO);
fb('Warn message' ,FirePHP::WARN);
fb('Error message',FirePHP::ERROR);
 
fb('Message with label','Label',FirePHP::LOG);
 
fb(array('key1'=>'val1',
         'key2'=>array(array('v1','v2'),'v3')),
   'TestArray',FirePHP::LOG);
 
function test($Arg1) {
 throw new Exception('Test Exception');
}
try {
 test(array('Hello'=>'World'));
} catch(Exception $e) {
 /* Log exception including stack trace & variables */
 fb($e);
}
 
fb(array('2 SQL queries took 0.06 seconds',array(
   array('SQL Statement','Time','Result'),
   array('SELECT * FROM Foo','0.02',array('row1','row2')),
   array('SELECT * FROM Bar','0.04',array('row1','row2'))
 )),FirePHP::TABLE);
     
?>

具体api可看http://www.firephp.org/HQ/Use.htm

 

posted @ 2015-05-11 09:56  ahhg  阅读(398)  评论(0编辑  收藏  举报