Home  >  Article  >  Backend Development  >  PHP的_FUNCTION_与_METHOD_的不同

PHP的_FUNCTION_与_METHOD_的不同

WBOY
WBOYOriginal
2016-06-13 10:40:10799browse

PHP的__FUNCTION__与__METHOD__的不同

使用__FUNCTION__仅传回函数名称

使用__METHOD__传回类名称与函数名称

?

如:我们建立一个类

?

?

class a {    function fa() {        return __METHOD__;    }        function fb() {        return __FUNCTION__;    }}$Obj = new a();echo $Obj->fa();// output a::faecho $Obj->fb();// output fb
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php &传摘引Next article:修理PHP 5.2/5.3 Hash漏洞