欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

PHP 类相关函数的使用详解

时间:2021-07-03 08:26:44|栏目:PHP代码|点击:

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 )― 如果对象属于该类或该类是此对象的父类则返回 TRUE
bool is_subclass_of ( object $object , string $class_name )― 检测对象是该类的子类实例化得到的
bool method_exists ( object $object , string $method_name )― 检查类的方法是否存在
bool property_exists ( mixed $class , string $property ) ― 检查对象或类是否具有该属性

上一篇:使用array_map简单搞定PHP删除文件、删除目录

栏    目:PHP代码

下一篇:ZF框架实现发送邮件的方法

本文标题:PHP 类相关函数的使用详解

本文地址:http://www.codeinn.net/misctech/151869.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有