Is there any way to find out which file runs function/class in PHP.
I have index.php
which includes functions/classes, than it includes other files depending on url. I wish to know which file runs function/class for debugging.
For example I have MySql class and I what to know which file used this class.
One option is to type the file name in function like $sql->do($cmd,$fileName)
, but there are too many files so I can't change all them.
See debug_backtrace .
In your MySql class you can simply call this function, and trace the call to it's origin.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.