热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

PHP反射的一些特性

publicfunctiongetByObjectId($id){$id(int)$id;if($id){$SQLselect*from{$this-__DTN}whereid


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



推荐阅读
  • 前景:当UI一个查询条件为多项选择,或录入多个条件的时候,比如查询所有名称里面包含以下动态条件,需要模糊查询里面每一项时比如是这样一个数组条件:newstring[]{兴业银行, ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文介绍了深入浅出Linux设备驱动编程的重要性,以及两种加载和删除Linux内核模块的方法。通过一个内核模块的例子,展示了模块的编译和加载过程,并讨论了模块对内核大小的控制。深入理解Linux设备驱动编程对于开发者来说非常重要。 ... [详细]
  • 预备知识可参考我整理的博客Windows编程之线程:https:www.cnblogs.comZhuSenlinp16662075.htmlWindows编程之线程同步:https ... [详细]
  • Java序列化对象传给PHP的方法及原理解析
    本文介绍了Java序列化对象传给PHP的方法及原理,包括Java对象传递的方式、序列化的方式、PHP中的序列化用法介绍、Java是否能反序列化PHP的数据、Java序列化的原理以及解决Java序列化中的问题。同时还解释了序列化的概念和作用,以及代码执行序列化所需要的权限。最后指出,序列化会将对象实例的所有字段都进行序列化,使得数据能够被表示为实例的序列化数据,但只有能够解释该格式的代码才能够确定数据的内容。 ... [详细]
  • 本文介绍了Java高并发程序设计中线程安全的概念与synchronized关键字的使用。通过一个计数器的例子,演示了多线程同时对变量进行累加操作时可能出现的问题。最终值会小于预期的原因是因为两个线程同时对变量进行写入时,其中一个线程的结果会覆盖另一个线程的结果。为了解决这个问题,可以使用synchronized关键字来保证线程安全。 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • Oracle seg,V$TEMPSEG_USAGE与Oracle排序的关系及使用方法
    本文介绍了Oracle seg,V$TEMPSEG_USAGE与Oracle排序之间的关系,V$TEMPSEG_USAGE是V_$SORT_USAGE的同义词,通过查询dba_objects和dba_synonyms视图可以了解到它们的详细信息。同时,还探讨了V$TEMPSEG_USAGE的使用方法。 ... [详细]
  • 本文介绍了Python爬虫技术基础篇面向对象高级编程(中)中的多重继承概念。通过继承,子类可以扩展父类的功能。文章以动物类层次的设计为例,讨论了按照不同分类方式设计类层次的复杂性和多重继承的优势。最后给出了哺乳动物和鸟类的设计示例,以及能跑、能飞、宠物类和非宠物类的增加对类数量的影响。 ... [详细]
  • Java自带的观察者模式及实现方法详解
    本文介绍了Java自带的观察者模式,包括Observer和Observable对象的定义和使用方法。通过添加观察者和设置内部标志位,当被观察者中的事件发生变化时,通知观察者对象并执行相应的操作。实现观察者模式非常简单,只需继承Observable类和实现Observer接口即可。详情请参考Java官方api文档。 ... [详细]
author-avatar
缺氧
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有