search

Home  >  Q&A  >  body text

How does PHP determine what target called it in a method?

1. Just like the title
2. Code

a.php

include(b.php);
b();

b.php

function b(){

   echo 'What calls me is the second line of a.php';
}

The code is as above. How can we determine who called it in b and get the file name and line number

滿天的星座滿天的星座2795 days ago612

reply all(1)I'll reply

  • 黄舟

    黄舟2017-05-16 13:11:20

    debug_backtrace()

    reply
    0
  • Cancelreply