This article briefly introduces the usage of METHOD, which is a magic constant that will only be available after php5. Friends in need can refer to it.
__METHOD__ is a new magic constant after PHP5, which represents the name of the class grammar
The code is as follows
代码如下 |
复制代码 |
class chhua{
function test(){
echo __METHOD__;
}
}
$e=new chhua();
$e->test();//输出:chhua::test
|
|
Copy code
|
class chhua{
function test(){ |
echo __METHOD__;
}
}
$e=new chhua();
$e->test();//Output: chhua::test
There are more such functions, such as __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(),
__set_state() and __clone() are not introduced here. You can search them on Baidu.
http://www.bkjia.com/PHPjc/628926.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/628926.htmlTechArticleThis article will briefly introduce the usage of METHOD. This is a magic constant that will only be available after php5. If necessary, Friends can refer to it. __METHOD__ is a new magic constant after PHP5, which represents the class text...
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