xdebug調試php程式

來源:互聯網
上載者:User

標籤:

相關設定

xdebug.default_enable=1

預設是1,當錯誤出現時,堆疊追蹤會啟用。可以在代碼中通過xdebug_disable()來關閉它。

xdebug.force_display_errors=0

預設是0,如果設定為1,錯誤總是會被展示,不管PHP的display_errors是怎麼設定的。

xdebug.force_error_reporting=0

預設是0,就像error_reporting。允許你強制顯示特定層級的錯誤,不管程式中的ini_set()如何設定。它只能通過php.ini修改。

xdebug.halt_level=0

xdebug.max_nesting_level=100

xdebug.scream=0

如果設定為1,會屏蔽@操作符,以至於notices,warnings和errors不在隱藏。

相關函數

string xdebug_call_class()

返回調用的class

<?php    function fix_string($a)    {        echo "Called @ ".            xdebug_call_file().            ":".            xdebug_call_line().            " from ".            xdebug_call_function();    }    $ret = fix_string(array(‘Derick‘));?>

 

返回:

Called @ /home/httpd/html/test/xdebug_caller.php:12 from {main}

string xdebug_call_file()

 

返回調用的檔案

string xdebug_call_function()

 

返回調用的函數/方法

int xdebug_call_line()

 

返回行號

void xdebug_disable()

禁用堆疊追蹤void xdebug_enable()開啟堆疊追蹤void xdebug_get_collected_errors( [int clean] ) 

返回所有收集到的錯誤資訊

array xdebug_get_headers()

 

返回PHP的header()函數設定的headers

<?phpheader( "X-Test", "Testing" );setcookie( "TestCookie", "test-value" );var_dump( xdebug_get_headers() );?>

 

返回:

array(2) {  [0]=>  string(6) "X-Test"  [1]=>  string(33) "Set-Cookie: TestCookie=test-value"}

bool xdebug_is_enabled()

 

返回堆疊追蹤是否開啟

int xdebug_memory_usage()

 

返回當前佔用記憶體

int xdebug_peak_memory_usage()

返回佔用記憶體的峰值

void xdebug_start_error_collection()

 

開始收集所有的notices,warnings和errors並阻止它們被顯示

void xdebug_stop_error_collection()

停止收集所有的notices,warnings和errors。

float xdebug_time_index()

 

返回目前時間索引

<?phpecho xdebug_time_index(), "\n";for ($i = 0; $i < 250000; $i++){    // do nothing}echo xdebug_time_index(), "\n";?>

 

返回

0.000380039215087890.76580691337585

 

xdebug調試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.