服务器端怎么用PHP,firephp 服务器端使用方式

本文介绍了如何在PHP项目中通过FirePHP实现客户端与服务器端的通信,包括引入库、创建FirePHP实例、常用函数及其功能,如日志记录、分组、表格输出和异常处理。适合开发者快速掌握在服务端使用FirePHP进行调试和信息传递的方法。
摘要由CSDN通过智能技术生成

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();

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值