標籤:
相關設定
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程式