PHP debug_backtrace in production code to get information about calling method?

后端 未结 7 1027
野趣味
野趣味 2020-11-29 05:43

Is there a compelling reason to not use debug_backtrace for the sole purpose of determining the calling method\'s class, name, and parameter list? Not for debugging purposes

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 06:25

    I'm thinking about using the debug_backtrace for debugging mysql statements. It's a hell a lot of easier to pinpoint erroneous or slow queries when you have a header like this at the start of each query inside the database logs:

    /*Called from /var/www/micimacko.php at line 28*/ SELECT count(*) FROM rofibeka;
    

    The question remains. What about performance/reliability.

提交回复
热议问题