Is debug_backtrace() safe for serious usage in production environment?

前端 未结 3 528
情话喂你
情话喂你 2021-01-21 01:41

It\'s functionality is so strong that I worry about its stability and performance.

What do you think?

UPDATE

What I\'m doing is this:

3条回答
  •  既然无缘
    2021-01-21 02:30

    Ok, from my understanding, the problem is following

    You've got a php file, let's call it "main.php". In "main.php" you're including "A.php" from some directory:

    # in "main.php"
    include '/some/dir/A.php';
    

    A.php, in turn, includes 'B.php', which is in the same directory as A.php

    # in "A.php"
    include 'B.php'; 
    

    the problem: since "/some/dir/" (where A and B reside) is not the current for "main.php", php does not see B.php from A.php

    the solution: in A.php use an absolute full path to /some/dir. Either hardcode it or obtain it dynamically via dirname(__FILE__)

    # in "A.php"
    include dirname(__FILE__) .'/B.php';
    

提交回复
热议问题