有可能做这样的事情吗?
public function something() {
$thisMethodName = method_get_name();
}
method_get_name()
在哪里返回方法的名称?
最佳答案
当然,你想要魔法常数。
function myFunction() { print __FUNCTION__." in ".__FILE__." at ".__LINE__."\n"; }
从 the php manual 了解更多信息
关于php - 您可以从 PHP 中的方法中获取方法名称吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1424846/