php log 行号 debug_backtrace,php debug_backtrace() 函数

debug_backtrace() 函数生成 backtrace(回溯跟踪)。

该函数显示由 debug_backtrace() 函数代码生成的数据。

返回一个关联数组。可能返回的元素如下:

名称 类型 描述

function string 当前函数名称

line integer 当前行号

file string 当前文件名

class string 当前类名

object object 当前对象

type string

当前调用类型。可能的调用:

返回: "->" - 方法调用

返回: "::" - 静态方法调用

返回 nothing - 函数调用

args array 如果在函数中,列出函数参数。如果在被引用的文件中,列出被引用的文件名。

function a($txt) {

b("Glenn");

}

function b($txt) {

c("Cleveland");

}

function c($txt) {

var_dump(debug_backtrace());

}

a("Peter");

?>

以上代码的输出类似这样:

Array (

[0] => Array (

[file] => C:\webfolder\test.php

[line] => 6

[function] => c

[args] => Array (

[0] => Cleveland

)

)

[1] => Array (

[file] => C:\webfolder\test.php

[line] => 3

[function] => b

[args] => Array (

[0] => Glenn

)

)

[2] => Array (

[file] => C:\webfolder\test.php

[line] => 11

[function] => a

[args] => Array (

[0] => Peter

)

)

)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值