PHP调试技巧 之 FirePHP

来源:互联网 发布:微软办公软件下载 编辑:程序博客网 时间:2024/05/22 15:53

        PHP调试不能做到断点调试、具体报错......等等,这些问题给我们带来了很大的麻烦。有时候一个符号可能就得花费我们几小时去查找...能不能在出错的时候提示我们,能不能让我们好好的敲代码。。。

         火狐浏览器的firebug相信大家都不陌生,他让我们能够断点调试JavaScript甚是方便,但是firephp是什么鬼???其实是firebug的一个拓展。先来看看人家官方怎么介绍的吧------

       Firebug Extension for PHP based AJAX DevelopmentFirePHP enables you to log to your Firebug Console using a simple PHP method call.

FirePHP is ideally suited for AJAX development where clean JSON or XML responses are required. All data is sent via response headers. This means that the debugging data will not interfere with the content on your page.

Not using Firebug 1.9+ on Firefox 8+? See http://firephp.org/

Requirements (Firefox 8+): //要求

You must have Firebug 1.9+ installed and the Firebug "Console" and "Net" panels enabled to use this extension.
You must also download a PHP library from github.com/firephp/firephp-core and include it in your application.


      翻译过来就是:

                   功能:               给PHP开发人员用来在FireBug控制台输出的

                   要求                    1   有火狐浏览器    、firebug 拓展组件 、  firebug组件的 网络控制台得打开

                                                2  下载一个库

1 如何安装?

         先安装firebug组件,再安装firephp组件。                   

                            安装完后必须要做::::   随便一个网页,按F12。把里面的控制台、网络等都打开并启用!!!


2.下载库文件

          点击下载

解压后我们只要把里面的两个文件放到我们网站目录里面就行。

3.编辑程序测试

    

<?phprequire_once('FirePHPCore/FirePHP.class.php');$firephp = FirePHP::getInstance(true);$firephp->group(array("this" => "is", "group" => "output"));$firephp->log("Log", "Label");$firephp->info("Info test '");$firephp->error("Error", "Err Label");$firephp->warn("Warning");$firephp->log(array(0 => "A", "Z" => "Y"));$firephp->log(array(1, 2, array(0 => "A", "Z" => "Y"), 4, 5));$firephp->groupEnd();
把这段代码放到服务器上,打开控制台并访问我们的php网页,就能在控制台看到如下:

注意 其中的数组可以拓展打开。下次我们再说它能输出哪类型的信息....

0 0
原创粉丝点击