您的位置:首页 > 编程语言 > PHP开发

PHP 类相关函数的使用详解

2013-05-10 17:09 736 查看
bool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) ― 为一个类创建别名bool class_exists ( string $class_name [, bool $autoload ] )― 检查类是否已定义string get_called_class ( void ) ―获取静态方法调用的类名 复制代码 代码如下: class foo {    static public function test(){        var_dump(get_called_class());    }}class bar extends foo {}foo::test();bar::test(); array get_class_methods ( mixed $class_name )― 返回由类的方法名组成的数组array get_class_vars ( string $class_name )― 返回由类的默认属性组成的数组string get_class ([ object $obj ] )― 返回对象的类名array get_declared_classes ( void )― 返回当前脚本中已定义类的名字组成的数组array get_declared_interfaces ( void )― 返回当前脚本中所有已声明的接口的名字数组array get_object_vars ( object $obj )― 返回由对象属性组成的关联数组string get_parent_class ([ mixed $obj ] )― 返回对象或类的父类名bool interface_exists ( string $interface_name [, bool $autoload ] )― 检查接口是否已被定义bool is_a ( object $object , string $class_name )― 如果对象属于该类或该类是此对象的父类则返回 TRUEbool is_subclass_of ( object $object , string $class_name )― 检测对象是该类的子类实例化得到的bool method_exists ( object $object , string $method_name )― 检查类的方法是否存在bool property_exists ( mixed $class , string $property ) ― 检查对象或类是否具有该属性
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  PHP 相关函数