search
Homephp教程php手册Xdebug文档(一)基本特性

基本属性(参数)

 

xdebug.default_enable

类型: boolean,默认值: 1

这是xdebug的基本设置,默认在调试跟踪时显示错误信息。可以使用xdebug_disable()函数使你的代码不显示调试显示。

 

xdebug.force_display_errors

类型: int, 默认值: 0, 始于Xdebug 2.3版

此设置设为1时,不管PHP设置display_errors设置值是多少,错误信息将强制性一直显示。

 

xdebug.force_error_reporting

类型: int, 默认值: 0, 始于Xdebug 2.3版

这是类似error_reporting的掩码值,它使用逻辑或关系组织掩码值来确定哪些错误该不该显示。该设置只能在php.ini配置,不能用ini_set()函数。

 

xdebug.halt_level

类型: int, 默认值: 0, 始于Xdebug 2.3版

此设置值将一掩码值来决定转换成哪种类型的错误。支持四种级别的的设置:

xdebug.halt_level=E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE<br><br><br>
xdebug.max_nesting_level
类型: integer, 默认值: 256(2.3之前的版本默认值为100)
该设置值允许嵌套函数的在脚本停止前的运行的最大层级。
 
xdebug.scream
类型: boolean,  默认值: 0, 始于 Xdebug版本 >= 2.1
该值若设置为1,则xdebug将显示标识@符号的语句的通知、警告和错误,并不再隐藏。
 
 
相关的函数:
 
string xdebug_call_file()
返回当前执行此函数所在的文件名。
 
string xdebug_call_function()
返回当前函数被调用执行时的函数来源名称。
 
int xdebug_call_line()
返回当前执行的行号。
 
示例:
Example:

<span style="color: #000000;">php
    </span><span style="color: #0000ff;">function</span> fix_string(<span style="color: #800080;">$a</span><span style="color: #000000;">)
    {
        </span><span style="color: #0000ff;">echo</span> "Called @ ".<span style="color: #000000;">
            xdebug_call_file()</span>.
            ":".<span style="color: #000000;">
            xdebug_call_line()</span>.
            " from ".<span style="color: #000000;">
            xdebug_call_function();
    }

    </span><span style="color: #800080;">$ret</span> = fix_string(<span style="color: #0000ff;">array</span>('Derick'<span style="color: #000000;">));
</span>?>

<span style="color: #008000;">//</span><span style="color: #008000;"> Called @ /home/httpd/html/test/xdebug_caller.php:12 from {main}</span>

 

string xdebug_call_class()
返回调用的类名。
 
void xdebug_disable()
不显示错误跟踪信息。
 
void xdebug_enable()
显示错误跟踪信息。
 
string xdebug_get_collected_errors( [int clean] )
始于版本 2.1
该函数返回所有收集的错误信息,这些信息以表格形式格式化。
错误信息的收集起始点,使用函数xdebug_start_error_collection()决定。
默认情况下该函数不会清空错误信息收集缓存,你可以设置参数为true则缓存会清空。
 
array xdebug_get_headers()
以数组方式返回所有header信息,凡是调用了header()函数设置的头部信息都会返回。
<span style="color: #000000;">php
</span><span style="color: #008080;">header</span>( "X-Test", "Testing"<span style="color: #000000;"> );
</span><span style="color: #008080;">setcookie</span>( "TestCookie", "test-value"<span style="color: #000000;"> );
</span><span style="color: #008080;">var_dump</span><span style="color: #000000;">( xdebug_get_headers() );
</span>?>

<span style="color: #008000;">/*</span><span style="color: #008000;">*
Returns:

array(2) {
  [0]=>
  string(6) "X-Test"
  [1]=>
  string(33) "Set-Cookie: TestCookie=test-value"
}
</span><span style="color: #008000;">*/</span>
bool xdebug_is_enabled()
检测调试跟踪是否有效。
 
int xdebug_memory_usage()
返回脚本对内存使用量。PHP5.2.1之前编译的版本必须附带--enable-memory-limit参数才有效,在这之后的版本则一直有效。
 
int xdebug_peak_memory_usage()
返回内存使用的最高值。PHP5.2.1之前编译的版本必须附带--enable-memory-limit参数才有效,在这之后的版本则一直有效。
 
void xdebug_start_error_collection()
始于版本 2.1
该函数一执行,PHP将不再显示任何通知警告和错误信息,这些信息将会存入一缓存中,除非执行到xdebug_stop_error_collection()才会停止。
缓存中的错误信息内容可以通过xdebug_get_collected_errors()函数获取。
 
void xdebug_stop_error_collection()
始于版本2.1
与xdebug_start_error_collection()相对,它会停止收集所有通知、警告和错误信息。注意,它不会清除收集错误的缓存。
 
float xdebug_time_index()
返回当前的时间索引,即从脚本开始运行后的秒数,以浮点数表示。
<span style="color: #000000;">php
</span><span style="color: #0000ff;">echo</span> xdebug_time_index(), "\n"<span style="color: #000000;">;
</span><span style="color: #0000ff;">for</span> (<span style="color: #800080;">$i</span> = 0; <span style="color: #800080;">$i</span> $i++<span style="color: #000000;">)
{
    </span><span style="color: #008000;">//</span><span style="color: #008000;"> do nothing</span>
<span style="color: #000000;">}
</span><span style="color: #0000ff;">echo</span> xdebug_time_index(), "\n"<span style="color: #000000;">;
</span>?>
<span style="color: #008000;">/*</span><span style="color: #008000;">*
Returns:

0.00038003921508789
0.76580691337585
</span><span style="color: #008000;">*/</span>

 

 
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software