利用firephp調試php項目

來源:互聯網
上載者:User

標籤:調試   php   firebug   

前段時間在寫一個項目一個基類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();}?>



利用firephp調試php項目

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.