Home > php教程 > php手册 > body text

PHP的__METHOD__魔术常量用法

WBOY
Release: 2016-05-25 16:47:33
Original
1310 people have browsed it

本文章来简单的介绍METHOD的用法,这在php5之后才会有的魔术常量,有需要的朋友可参考.

__METHOD__ 是PHP5之后新增的魔术常量,表示的是类文法的名称

实例代码如下:

<?php
class chhua {
    function test() {
        echo __METHOD__;
    }
}
$e = new chhua();
$e->test(); //输出:chhua::test
?>
Copy after login

还有更多的此类函数,如有__isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(),

__set_state() and __clone()这里就不介绍了大家可百度搜索.


教程链接:

随意转载~但请保留教程地址★

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!