PHP debug_backtrace() 函数
PHP 教程
· 2019-01-24 14:14:21
定义和用法
debug_backtrace() 函数生成 backtrace。
该函数显示由 debug_backtrace() 函数代码生成的数据。
返回一个关联数组。下面是可能返回的元素:
| 名称 | 类型 | 描述 |
|---|---|---|
| function | string | 当前的函数名。 |
| line | integer | 当前的行号。 |
| file | string | 当前的文件名。 |
| class | string | 当前的类名。 |
| object | object | 当前对象。 |
| type | string | 当前的调用类型,可能的调用:
|
| args | array | 如果在函数中,列出函数参数。如果在被引用的文件中,列出被引用的文件名。 |
语法
debug_backtrace()
实例
<?php
function one($str1, $str2)
{
two("Glenn", "Quagmire");
}
function two($str1, $str2)
{
three("Cleveland", "Brown");
}
function three($str1, $str2)
{
print_r(debug_backtrace());
}
one("Peter", "Griffin");
?>
上面代码的输出如下所示:
Array
(
[0] => Array
(
[file] => C:webfoldertest.php
[line] => 7
[function] => three
[args] => Array
(
[0] => Cleveland
[1] => Brown
)
)
[1] => Array
(
[file] => C:webfoldertest.php
[line] => 3
[function] => two
[args] => Array
(
[0] => Glenn
[1] => Quagmire
)
)
[2] => Array
(
[file] => C:webfoldertest.php
[line] => 14
[function] => one
[args] => Array
(
[0] => Peter
[1] => Griffin
)
)
)
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
C程序设计(第四版)
谭浩强 / 清华大学出版社 / 2010-6-1 / 33.00元
由谭浩强教授著、清华大学出版社出版的《C程序设计》是一本公认的学习C语言程序设计的经典教材。根据C语言的发展和计算机教学的需要,作者在《C程序设计(第三版)》的基础上进行了修订。 《C程序设计(第4版)》按照C语言的新标准C99进行介绍,所有程序都符合C99的规定,使编写程序更加规范;对C语言和程序设计的基本概念和要点讲解透彻,全面而深入;按照作者提出的“提出问题―解决问题―归纳分析”三部曲......一起来看看 《C程序设计(第四版)》 这本书的介绍吧!