热门标签 | 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



推荐阅读
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社区 版权所有