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

PHP的_FUNCTION_与_METHOD_的不同

WBOY
Release: 2016-06-13 10:40:10
Original
816 people have browsed it

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
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template