__FUNCTION__ 和__METHOD__区别
2020-04-01 12:43
447 查看
__FUNCTION__ 只是返回方法(或者函数)的名字;
__METHOD__ 返回类名和方法的名字;
返回类的名字和方法的名字。
class Test{
public function doit(){
echo __FUNCTION__; //output doit
}
public function doitAgain(){
echo __METHOD__; //output Test::doitAgain
}
}
$obj = new Test();
$obj->doit();
echo '<br>';
$obj->doitAgain();
转载于:https://my.oschina.net/u/2005502/blog/812438
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- abap 中:module ,form, method ,function, define 的区别和联系
- Function & Method的区别 为什么类中成员函数的指针需要显式地声明?
- function_exists 、 method_exists 和 is_callable 的区别
- 【PHP】function_exists , method_exists 与 is_callable的区别
- PHP中魔术变量__METHOD__与__FUNCTION__的区别
- 渣翻——Function、Method、Procedure和Subroutine的区别
- method和function的区别
- Python函数(function)与方法(method)区别
- PHP中__FUNCTION__与__METHOD__的区别
- scala中的method和function的区别
- 区别method和function
- function method(){}与var method = function(){}的区别
- __FUNCTION__ 和__METHOD__区别
- 方法(method)和函数(function)的区别
- AS3中的一些基本定义,Function与Method的区别
- Python里method和function的区别
- PHP中魔术变量__METHOD__与__FUNCTION__的区别
- PHP的method_exists,function_exists,is_callable的区别
- function_exists, method_exists, is_callable的区别
- scala之method和function的区别