当前位置: 首页 > news >正文

PHP反射的一些特性

    public function getByObjectId($id) {
        $id = (int) $id;
        if ($id) {
            $SQL = "select * from {$this->__DTN} where id=$id";
            $refl = new ReflectionClass(get_class($this));
            return $refl->newInstance();
        } else {
            return false;
        }
    }
 
手册中:

Classes/Object 函数

Table of Contents

  • call_user_method_array — 调用一个用户方法,同时传递参数数组(已废弃)
  • call_user_method — 对特定对象调用用户方法(已废弃)
  • class_alias — Creates an alias for a class
  • class_exists — 检查类是否已定义
  • get_called_class — the "Late Static Binding" class name
  • get_class_methods — 返回由类的方法名组成的数组
  • get_class_vars — 返回由类的默认属性组成的数组
  • get_class — 返回对象的类名
  • get_declared_classes — 返回由已定义类的名字所组成的数组
  • get_declared_interfaces — 返回一个数组包含所有已声明的接口
  • get_object_vars — 返回由对象属性组成的关联数组
  • get_parent_class — 返回对象或类的父类名
  • interface_exists — 检查接口是否已被定义
  • is_a — 如果对象属于该类或该类是此对象的父类则返回 TRUE
  • is_subclass_of — 如果此对象是该类的子类,则返回 TRUE
  • method_exists — 检查类的方法是否存在
  • property_exists — 检查对象或类是否具有该属性

 

  • Reflection — The Reflection class
    • Reflection::export — Exports
    • Reflection::getModifierNames — Gets modifier names
  • ReflectionClass — The ReflectionClass class
    • ReflectionClass::__clone — Clones object
    • ReflectionClass::__construct — Constructs a ReflectionClass
    • ReflectionClass::export — Exports a class
    • ReflectionClass::getConstant — Gets defined constants
    • ReflectionClass::getConstants — Gets constants
    • ReflectionClass::getConstructor — Gets constructor
    • ReflectionClass::getDefaultProperties — Gets default properties
    • ReflectionClass::getDocComment — Gets doc comments
    • ReflectionClass::getEndLine — Gets end line
    • ReflectionClass::getExtension — Gets extension info
    • ReflectionClass::getExtensionName — Gets an extensions name
    • ReflectionClass::getFileName — Gets the filename of the file in which the class has been defined
    • ReflectionClass::getInterfaceNames — Gets the interface names
    • ReflectionClass::getInterfaces — Gets the interfaces
    • ReflectionClass::getMethod — Gets a ReflectionMethod
    • ReflectionClass::getMethods — Gets a list of methods
    • ReflectionClass::getModifiers — Gets modifiers
    • ReflectionClass::getName — Gets class name
    • ReflectionClass::getNamespaceName — Gets namespace name
    • ReflectionClass::getParentClass — Gets parent class
    • ReflectionClass::getProperties — Gets properties
    • ReflectionClass::getProperty — Gets property
    • ReflectionClass::getShortName — Gets short name
    • ReflectionClass::getStartLine — Gets starting line number
    • ReflectionClass::getStaticProperties — Gets static properties
    • ReflectionClass::getStaticPropertyValue — Gets static property value
    • ReflectionClass::hasConstant — Checks if constant is defined
    • ReflectionClass::hasMethod — Checks if method is defined
    • ReflectionClass::hasProperty — Checks if property is defined
    • ReflectionClass::implementsInterface — Implements interface
    • ReflectionClass::inNamespace — Checks if in namespace
    • ReflectionClass::isAbstract — Checks if class is abstract
    • ReflectionClass::isFinal — Checks if class is final
    • ReflectionClass::isInstance — Checks class for instance
    • ReflectionClass::isInstantiable — Checks if instantiable
    • ReflectionClass::isInterface — Checks if interface
    • ReflectionClass::isInternal — Checks if internal
    • ReflectionClass::isIterateable — Checks if iterateable
    • ReflectionClass::isSubclassOf — Checks if a subclass
    • ReflectionClass::isUserDefined — Checks if user defined
    • ReflectionClass::newInstance — Creates a new cass instance from given arguments.
    • ReflectionClass::newInstanceArgs — Creates a new cass instance from given arguments.
    • ReflectionClass::setStaticPropertyValue — Sets static property value
    • ReflectionClass::__toString — Returns the string representation of the ReflectionClass object.
  • ReflectionExtension — The ReflectionExtension class
    • ReflectionExtension::__clone — Clones
    • ReflectionExtension::__construct — Constructs a ReflectionExtension
    • ReflectionExtension::export — Export
    • ReflectionExtension::getClasses — Gets classes
    • ReflectionExtension::getClassNames — Gets class names
    • ReflectionExtension::getConstants — Gets constants
    • ReflectionExtension::getDependencies — Gets dependencies
    • ReflectionExtension::getFunctions — Gets extension functions
    • ReflectionExtension::getINIEntries — Gets extension ini entries
    • ReflectionExtension::getName — Gets extension name
    • ReflectionExtension::getVersion — Gets extension version
    • ReflectionExtension::info — Gets extension info
    • ReflectionExtension::__toString — To string
  • ReflectionFunction — The ReflectionFunction class
    • ReflectionFunction::__construct — Constructs a ReflectionFunction object
    • ReflectionFunction::export — Exports function
    • ReflectionFunction::invoke — Invokes function
    • ReflectionFunction::invokeArgs — Invokes function args
    • ReflectionFunction::isDisabled — Checks if function is disabled
    • ReflectionFunction::__toString — To string
  • ReflectionFunctionAbstract — The ReflectionFunctionAbstract class
    • ReflectionFunctionAbstract::__clone — Clones function
    • ReflectionFunctionAbstract::getDocComment — Gets doc comment
    • ReflectionFunctionAbstract::getEndLine — Gets end line number
    • ReflectionFunctionAbstract::getExtension — Gets extension info
    • ReflectionFunctionAbstract::getExtensionName — Gets extension name
    • ReflectionFunctionAbstract::getFileName — Gets file name
    • ReflectionFunctionAbstract::getName — Gets function name
    • ReflectionFunctionAbstract::getNamespaceName — Gets namespace name
    • ReflectionFunctionAbstract::getNumberOfParameters — Gets number of parameters
    • ReflectionFunctionAbstract::getNumberOfRequiredParameters — Gets number of required parameters
    • ReflectionFunctionAbstract::getParameters — Gets parameters
    • ReflectionFunctionAbstract::getShortName — Gets function short name
    • ReflectionFunctionAbstract::getStartLine — Gets starting line number
    • ReflectionFunctionAbstract::getStaticVariables — Gets static variables
    • ReflectionFunctionAbstract::inNamespace — Checks if function in namespace
    • ReflectionFunctionAbstract::isClosure — Checks if closure
    • ReflectionFunctionAbstract::isDeprecated — Checks if deprecated
    • ReflectionFunctionAbstract::isInternal — Checks if is internal
    • ReflectionFunctionAbstract::isUserDefined — Checks if user defined
    • ReflectionFunctionAbstract::returnsReference — Checks if returns reference
    • ReflectionFunctionAbstract::__toString — To string
  • ReflectionMethod — The ReflectionMethod class
    • ReflectionMethod::__construct — Constructs a ReflectionMethod
    • ReflectionMethod::export — Export a reflection method.
    • ReflectionMethod::getDeclaringClass — Gets declaring class for the reflected method.
    • ReflectionMethod::getModifiers — Gets the method modifiers
    • ReflectionMethod::getPrototype — Gets the method prototype (if there is one).
    • ReflectionMethod::invoke — Invoke
    • ReflectionMethod::invokeArgs — Invoke args
    • ReflectionMethod::isAbstract — Checks if method is abstract
    • ReflectionMethod::isConstructor — Checks if method is a constructor
    • ReflectionMethod::isDestructor — Checks if method is a destructor
    • ReflectionMethod::isFinal — Checks if method is final
    • ReflectionMethod::isPrivate — Checks if method is private
    • ReflectionMethod::isProtected — Checks if method is protected
    • ReflectionMethod::isPublic — Checks if method is public
    • ReflectionMethod::isStatic — Checks if method is static
    • ReflectionMethod::setAccessible — Set method accessibility
    • ReflectionMethod::__toString — Returns the string representation of the Reflection method object.
  • ReflectionObject — The ReflectionObject class
    • ReflectionObject::__construct — Constructs a ReflectionObject
    • ReflectionObject::export — Export
  • ReflectionParameter — The ReflectionParameter class
    • ReflectionParameter::allowsNull — Checks if null is allowed
    • ReflectionParameter::__clone — Clone
    • ReflectionParameter::__construct — Construct
    • ReflectionParameter::export — Exports
    • ReflectionParameter::getClass — Get class
    • ReflectionParameter::getDeclaringClass — Gets declaring class
    • ReflectionParameter::getDeclaringFunction — Gets declaring function
    • ReflectionParameter::getDefaultValue — Gets default parameter value
    • ReflectionParameter::getName — Gets parameter name
    • ReflectionParameter::getPosition — Gets parameter position
    • ReflectionParameter::isArray — Checks if parameter expects an array
    • ReflectionParameter::isDefaultValueAvailable — Checks if a default value is available
    • ReflectionParameter::isOptional — Checks if optional
    • ReflectionParameter::isPassedByReference — Checks if passed by reference
    • ReflectionParameter::__toString — To string
  • ReflectionProperty — The ReflectionProperty class
    • ReflectionProperty::__clone — Clone
    • ReflectionProperty::__construct — Construct a ReflectionProperty object
    • ReflectionProperty::export — Export
    • ReflectionProperty::getDeclaringClass — Gets declaring class
    • ReflectionProperty::getDocComment — Gets doc comment
    • ReflectionProperty::getModifiers — Gets modifiers
    • ReflectionProperty::getName — Gets property name
    • ReflectionProperty::getValue — Gets value
    • ReflectionProperty::isDefault — Checks if default value
    • ReflectionProperty::isPrivate — Checks if property is private
    • ReflectionProperty::isProtected — Checks if property is protected
    • ReflectionProperty::isPublic — Checks if property is public
    • ReflectionProperty::isStatic — Checks if property is static
    • ReflectionProperty::setAccessible — Set property accessibility
    • ReflectionProperty::setValue — Set property value
    • ReflectionProperty::__toString — To string
  • Reflector — The Reflector interface
    • Reflector::export — Exports
    • Reflector::__toString — To string
 
 

转载于:https://www.cnblogs.com/brainmix/archive/2010/11/23/1885898.html

相关文章:

  • 思维导图培训六:思维导图的用途
  • dedecms模版制作使用方法
  • [CCIE历程]CCIE # 20604
  • 关于 TApplication 详解 四 ---- TControl
  • mockcpp testngpp在2010.7~11月的改进
  • 我想了解一下嵌入式软件开发
  • EP2C8Q PLL深入浅出解析
  • OSPF的虚连接
  • 第一周上课总结
  • 这些道理不懂,你注定就是穷打工的命!
  • 点评2009年PHP十大图书(1)
  • Facebook将推出自己的浏览器
  • Windows下NTP的配置
  • [原创][连载].基于SOPC的简易数码相框 - Nios II SBTE部分(软件部分) - SD卡(SPI模式)驱动...
  • 范式篇之四-第三范式
  • 【vuex入门系列02】mutation接收单个参数和多个参数
  • 【个人向】《HTTP图解》阅后小结
  • Angular6错误 Service: No provider for Renderer2
  • 从tcpdump抓包看TCP/IP协议
  • 构建二叉树进行数值数组的去重及优化
  • 聚类分析——Kmeans
  • 盘点那些不知名却常用的 Git 操作
  • 试着探索高并发下的系统架构面貌
  • 限制Java线程池运行线程以及等待线程数量的策略
  • 小程序、APP Store 需要的 SSL 证书是个什么东西?
  • 看到一个关于网页设计的文章分享过来!大家看看!
  • ​Linux·i2c驱动架构​
  • #{}和${}的区别是什么 -- java面试
  • #NOIP 2014# day.1 T3 飞扬的小鸟 bird
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • (1)Android开发优化---------UI优化
  • (4.10~4.16)
  • (poj1.3.2)1791(构造法模拟)
  • (八)Spring源码解析:Spring MVC
  • (顶刊)一个基于分类代理模型的超多目标优化算法
  • (附源码)springboot掌上博客系统 毕业设计063131
  • (蓝桥杯每日一题)love
  • (三)docker:Dockerfile构建容器运行jar包
  • (三)Pytorch快速搭建卷积神经网络模型实现手写数字识别(代码+详细注解)
  • (转)EXC_BREAKPOINT僵尸错误
  • (转)Sublime Text3配置Lua运行环境
  • (转)重识new
  • (转贴)用VML开发工作流设计器 UCML.NET工作流管理系统
  • (轉貼) 蒼井そら挑戰筋肉擂台 (Misc)
  • ... 是什么 ?... 有什么用处?
  • .NET 分布式技术比较
  • .netcore 获取appsettings
  • .NET中使用Redis (二)
  • /var/spool/postfix/maildrop 下有大量文件
  • @Autowired标签与 @Resource标签 的区别
  • @property python知乎_Python3基础之:property
  • [2019.3.20]BZOJ4573 [Zjoi2016]大森林
  • [Android Pro] Notification的使用
  • [Android View] 可绘制形状 (Shape Xml)
  • [Android]如何调试Native memory crash issue