(PHP 4 >= 4.3.0, PHP 5, PHP 7)
debug_backtrace — ����һ�����ݸ���(backtrace)
$options = DEBUG_BACKTRACE_PROVIDE_OBJECT
[, int $limit = 0
]] ) : arraydebug_backtrace() ����һ�� PHP �Ļ��ݸ���(backtrace)��
options���� 5.3.6���������������ѡ���λ���룺
| DEBUG_BACKTRACE_PROVIDE_OBJECT | �Ƿ���� "object" �������� |
| DEBUG_BACKTRACE_IGNORE_ARGS | �Ƿ���� "args" ���������������е� function/method �IJ������ܹ���ʡ�ڴ濪���� |
TRUE ���� FALSE���ֱ�����Ƿ����� DEBUG_BACKTRACE_PROVIDE_OBJECT ѡ�
limit
���� 5.4.0����������ܹ��������Ʒ��ض�ջ֡��������
Ĭ��Ϊ (limit=0) ���������еĶ�ջ֡��
����һ�������ڶ��������� array�� ��ΪΪ�п��ܷ��ص�Ԫ�أ�
| ���� | ���� | ˵�� |
|---|---|---|
| function | string | ��ǰ�ĺ��������μ��� __FUNCTION__�� |
| line | integer | ��ǰ���кš��μ��� __LINE__�� |
| file | string | ��ǰ���ļ������μ��� __FILE__�� |
| class | string | ��ǰ class �����ơ��μ� __CLASS__ |
| object | object | ��ǰ�� object�� |
| type | string | ��ǰ���õ����͡������һ���������᷵�� "->"�������һ����̬�������᷵�� "::"�� �����һ���������ã��ؿա� |
| args | array | �����һ�����������г������IJ����� �������һ�����������ļ�����г��������ļ����� |
| �汾 | ˵�� |
|---|---|
| 5.4.0 |
����˿�ѡ�IJ��� limit��
|
| 5.3.6 |
���� provide_object �ij� options�����������˿�ѡ����
DEBUG_BACKTRACE_IGNORE_ARGS��
|
| 5.2.5 |
����˿�ѡ���� provide_object��
|
| 5.1.1 | ����˵�ǰ�� object Ϊ���ܷ��ص�Ԫ�ء� |
Example #1 debug_backtrace() ����
<?php
// filename: /tmp/a.php
function a_test($str)
{
echo "\nHi: $str";
var_dump(debug_backtrace());
}
a_test('friend');
?>
<?php
// filename: /tmp/b.php
include_once '/tmp/a.php';
?>
ִ�� /tmp/b.php ���صĽ�����������£�
Hi: friend
array(2) {
[0]=>
array(4) {
["file"] => string(10) "/tmp/a.php"
["line"] => int(10)
["function"] => string(6) "a_test"
["args"]=>
array(1) {
[0] => &string(6) "friend"
}
}
[1]=>
array(4) {
["file"] => string(10) "/tmp/b.php"
["line"] => int(2)
["args"] =>
array(1) {
[0] => string(10) "/tmp/a.php"
}
["function"] => string(12) "include_once"
}
}