<?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 所属类的名字。
 


get_class的更多相关文章

  1. php get_class()函数

    <?php class Car { function getName(){ echo "My name is " . get_class() . "<br&g ...

  2. PHP的继承方法如何获取子类名?get_class() 和 get_called_class()

    PHP里的__CLASS__这类东西是静态绑定的,如果不在子类里重载的话,那么继承父类方法所得到的依旧是父类的名称,而不是子类的名称,比如: <?php class A { function _ ...

  3. PHP get_class 返回对象的类名

    get_class (PHP 4, PHP 5) get_class — 返回对象的类名 说明 string get_class ([ object $obj ] ) 返回对象实例 obj 所属类的名 ...

  4. php get_called_class()函数与get_class()函数的区别

    get_class (): 获取当前调用方法的类名: get_called_class():获取静态绑定后的类名: class Foo{ public function test(){ var_dum ...

  5. get_class __class__ get_called_class 分析记录

    首先看代码: class A { use T { T::say as aTsay; } public function say() { echo 'a__class__:' . __CLASS__ . ...

  6. get_class 返回对象的类名

    get_class — 返回对象的类名 传一个对象,可以把这个对象的类名返回出来(字符串) 参考: http://php.net/manual/zh/function.get-class.php

  7. php -- instanceof、class_exists、insterface_exists、method_exists、get_class、get_parent_class

    class_exists:类是否存在 在创建对象之前判断类是否存在,如果不存在就应该先加载类,再创建对象,容错. interface_exists:接口是否存在 method_exists:方法是否存 ...

  8. php get_called_class()函数与get_class函数的区别

    get_class (): 获取当前调用方法的类名: get_called_class():获取静态绑定后的类名: 有例为证: class Foo{ public function test(){ v ...

  9. 018对象——对象 get_class get_declared_classes get_declared_interfaces

    <?php /** * 对象 get_class get_declared_classes get_declared_interfaces */ //get_class() 获得对象的类名,区分 ...

随机推荐

  1. BZOJ 1001: [BeiJing2006]狼抓兔子(s-t平面图+最短路求最小割)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1001 题意: 思路:这道题目是最小割题目,但是吧你直接套用Dinic是会超时的. 这里有种很奇妙的做 ...

  2. 环境安装问题:tensorflow 问题记录 python2.7 和 python3.6发生冲突

    似乎是pip在python2.7和python3.6中发生冲突 我想用pip但是python2里没有装pip 但是tensorflow是和python2相关联的 所以我在python2中装pip的过程 ...

  3. (02) 任务(Jobs)和触发器(Triggers)

    Quart 的 API Quartz API 中的关键接口和类如下: IScheduler-与调度器(scheduler)进行交互的主要 API: IJob-被组件继承和实现,由调度器来执行的接口: ...

  4. c++ 匹配A容器中最先出现的b容器中的元素,返回iterator,(find_first_of)

    #include <iostream> // std::cout #include <algorithm> // std::find_first_of #include < ...

  5. Seleniumz中 dr.quit()和dr.close()的区别

    /** * dr.quit()和dr.close()都可以退出浏览器,简单的说一下两者的区别:第一个close, * 如果打开了多个页面是关不干净的,它只关闭当前的一个页面.第二个quit, * 是退 ...

  6. Qt5.3.2(VS2010)_调试_进入Qt源码

    1.必须是 Debug模式 2. http://blog.csdn.net/mayenjoy/article/details/42535789 http://blog.csdn.net/goforwa ...

  7. [原][osg][粒子特效]spark粒子特效生成流程

  8. Android之SwipeRefreshLayout下拉刷新组件

    SwipeRefreshLayout概述 SwipeRefrshLayout是Google官方更新的一个Widget,可以实现下拉刷新的效果.该控件集成自ViewGroup在support-v4兼容包 ...

  9. docker添加国内仓库安装iredmail

    centos 7: 1.yum install docker or yum update docker sudo tee /etc/docker/daemon.json <<-'EOF'{ ...

  10. thinkphp %s %d %f

    %s -- 表示字段串%d -- 表示整形数字%f -- 表示浮点数 例子:$order_number = $m_ebay_order_numbers->where("ebay_ord ...