hehexu

博客园 首页 新随笔 联系 订阅 管理
<?php
class foo {
    function foo()
    {
    // implements some logic
    }
    function name()
    {
        echo "My name is " , get_class($this) , "\n";
    }
}
// create an object
$bar = new foo();
// external call
echo "Its name is " , get_class($bar) , "\n";
// internal call
$bar->name();
?>
返回对象实例 obj 所属类的名字。
 

posted on 2018-01-26 09:10  hehexu  阅读(131)  评论(0编辑  收藏  举报