It is easy to get the current FILE name in php. Use the _ FILE _ constant. But what should I do if I define a general function and obtain the file that is currently called every time it is called? {Code...} is the above effect. It is very easy to get the current file name in php by calling get...
__FILE__Constant. But what should I do if I define a general function and obtain the file that is currently called every time it is called?
That is, the above effect, I callget_current_fileTo obtain the current call file, suchaction.php.
This is just an example. In actual use, I will not simply get the file name, but use some logic, but this is the most important step.
Reply content:
It is easy to get the current file name in php.__FILE__Constant. But what should I do if I define a general function and obtain the file that is currently called every time it is called?
That is, the above effect, I callget_current_fileTo obtain the current call file, suchaction.php.
This is just an example. In actual use, I will not simply get the file name, but use some logic, but this is the most important step.
Can Try http://cn2.php.net/manual/zh/function.debug-backtrace.php
There is an example similar to what you want.
" : ""; $c .= ($func != '') ? $func . "(): " : ""; return($c);}