如何在PHP中的函数中获取函数名称? [英] How do I get the function name inside a function in PHP?
本文介绍了如何在PHP中的函数中获取函数名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function test()
{
echofunction name is test ;
解决方案
准确的方法是使用 __ FUNCTION __
预定义神奇常数。
示例:
class Test {
function MethodA(){
echo __FUNCTION__;
$ b $结果: MethodA code>。
Is it possible?
function test()
{
echo "function name is test";
}
解决方案 The accurate way is to use the __FUNCTION__
predefined magic constant.
Example:
class Test {
function MethodA(){
echo __FUNCTION__;
}
}
Result: MethodA
.
这篇关于如何在PHP中的函数中获取函数名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文