列表格式显示

- 分类

广告招商中......
联系方式!

- 时间排序 更多...
    - 点击排序 更多...
      - 大小排序 更多...
        作者

         

        最近发布的软件 更多>>

        首页 >> >> >>PHP查看堆栈信息,PHP打印调用堆栈的三种方法 发布者:Private >> 本人发布的更多软件

        广告招商中...... 联系方式!

        PHP查看堆栈信息,PHP打印调用堆栈的三种方法 

        时间:2024-11-09 10:20:28      作者:Private     访问量:  
        ;开始下载地址

        目录

        一、debug_print_backtrace()

        二、debug_backtrace()

        三、Exception类中的getTraceAsString()成员函数返回一个调用堆栈

        一、debug_print_backtrace()

        //调用函数parent_func

        function child_func() {

        parent_func();

        }

        //调用grandparent_func

        function parent_func() {

        grandparent_func();

        }

        //打印调用堆栈

        function grandparent_func() {

        debug_print_backtrace();

        }

        //主函数调用

        child_func();

        #0 grandparent_func() called at [D:\wamp\www\temp.php:10]

        #1 parent_func() called at [D:\wamp\www\temp.php:5]

        #2 child_func() called at [D:\wamp\www\temp.php:19]

        二、debug_backtrace()

        //调用函数parent_func

        function child_func() {

        parent_func();

        }

        //调用grandparent_func

        function parent_func() {

        grandparent_func();

        }

        //打印调用堆栈

        function grandparent_func() {

        var_dump(debug_backtrace());

        }

        //主函数调用

        child_func();

        D:\wamp\www\temp.php:15:

        array (size=3)

        0 =>

        array (size=4)

        'file' => string 'D:\wamp\www\temp.php' (length=27)

        'line' => int 10

        'function' => string 'grandparent_func' (length=16)

        'args' =>

        array (size=0)

        empty

        1 =>

        array (size=4)

        'file' => string 'D:\wamp\www\temp.php' (length=27)

        'line' => int 5

        'function' => string 'parent_func' (length=11)

        'args' =>

        array (size=0)

        empty

        2 =>

        array (size=4)

        'file' => string 'D:\wamp\www\temp.php' (length=27)

        'line' => int 19

        'function' => string 'child_func' (length=10)

        'args' =>

        array (size=0)

        empty

        三、getTraceAsString()

        Exception类中的getTraceAsString()成员函数返回一个调用堆栈

        //调用函数parent_func

        function child_func() {

        parent_func();

        }

        //调用grandparent_func

        function parent_func() {

        grandparent_func();

        }

        //打印调用堆栈

        function grandparent_func() {

        $e = new Exception;

        var_dump($e->getTraceAsString());

        }

        //主函数调用

        child_func();

        D:\wamp\www\temp.php:16:string '#0 D:\wamp\www\temp.php(10): grandparent_func()

        #1 D:\wamp\www\temp.php(5): parent_func()

        #2 D:\wamp\www\temp.php(20): child_func()

        #3 {main}' (length=162)

        相关资源:PHP堆栈调试操作简单示例资源-CSDN文库



        本页Html网址:/htmlsoft/619446.html

        本页aspx网址:/soft.aspx?id=619446&bianhao=202411091020288142_37703&kind1=&kind2=

        最后访问时间:

        上一篇:如何查看无线网卡是否支持5g wifi

        下一篇:Python调用堆栈日志的方法

        增加   


        相关评论        新窗口打开查看评论