<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] * * * * * ## 1 反射的意義 php中的類,接口,函數,方法,擴展都是以**結構體對象與名稱**關聯的 反射API可以**通過名稱對其所關聯的結構體對象的屬性進行操作**。 反射API可操作結構體對象**包括擴展 類 接口 函數 方法**等。 ## 2 反射簡介 反射API的整體類結構如下 Reflector ;反射接口,反射類需要實現的功能 Reflection ;基礎反射操作類 ReflectionZendExtension ;Zend引擎擴展反射類 ReflectionExtension ;普通擴展反射類 ReflectionFunctionAbstract ;方法和函數的抽象反射類 ReflectionFunction ;函數反射類 ReflectionParameter ;方法和函數的參數反射類型 ReflectionClass ;類反射類 ReflectionObject ;對象反射類 ReflectionMethod ;類方法反射類 ReflctionProperty ;類屬性反射類 ## 3 類的反射類 ReflectionCLass ~~~ ReflectionClass implements Reflector { /* 常量 */ const integer IS_IMPLICIT_ABSTRACT = 16 ; const integer IS_EXPLICIT_ABSTRACT = 32 ; const integer IS_FINAL = 64 ; /* 屬性 */ public $name ; /* 方法 */ public __construct ( mixed $argument ) public static string export ( mixed $argument [, bool $return = false ] ) public mixed getConstant ( string $name ) public array getConstants ( void ) public ReflectionMethod getConstructor ( void ) public array getDefaultProperties ( void ) public string getDocComment ( void ) public int getEndLine ( void ) public ReflectionExtension getExtension ( void ) public string getExtensionName ( void ) public string getFileName ( void ) public array getInterfaceNames ( void ) public array getInterfaces ( void ) public ReflectionMethod getMethod ( string $name ) public array getMethods ([ int $filter ] ) public int getModifiers ( void ) public string getName ( void ) public string getNamespaceName ( void ) public object getParentClass ( void ) public array getProperties ([ int $filter ] ) public ReflectionProperty getProperty ( string $name ) public string getShortName ( void ) public int getStartLine ( void ) public array getStaticProperties ( void ) public mixed getStaticPropertyValue ( string $name [, mixed &$def_value ] ) public array getTraitAliases ( void ) public array getTraitNames ( void ) public array getTraits ( void ) public bool hasConstant ( string $name ) public bool hasMethod ( string $name ) public bool hasProperty ( string $name ) public bool implementsInterface ( string $interface ) public bool inNamespace ( void ) public bool isAbstract ( void ) public bool isCloneable ( void ) public bool isFinal ( void ) public bool isInstance ( object $object ) public bool isInstantiable ( void ) public bool isInterface ( void ) public bool isInternal ( void ) public bool isIterateable ( void ) public bool isSubclassOf ( string $class ) public bool isTrait ( void ) public bool isUserDefined ( void ) public object newInstance ( mixed $args [, mixed $... ] ) public object newInstanceArgs ([ array $args ] ) public object newInstanceWithoutConstructor ( void ) public void setStaticPropertyValue ( string $name , string $value ) public string __toString ( void ) } ~~~ >[info] 屬性: 類的名稱, ` name 只讀的,不可賦值` >[info] 常量: ReflectionClass 修飾符 ~~~ ReflectionClass::IS_IMPLICIT_ABSTRACT 指示了類是一個抽象類(abstract)因為它有抽象(abstract)方法 ReflectionClass::IS_EXPLICIT_ABSTRACT 指示了類是一個抽象類(abstract), 因為它已明確定義。 ReflectionClass::IS_FINAL 指示這是一個 final 類。 ~~~ >[info] 方法 **反射基礎操作** ~~~ ReflectionClass::__construct — 構造一個 ReflectionClass 類 ReflectionClass::export — 導出一個類 ReflectionClass::__toString — 返回 ReflectionClass 對象字符串的表示形式。 ~~~ **外在環境信息** ~~~ ReflectionClass::getFileName — 獲取定義類的文件名 ReflectionClass::getStartLine — 獲取起始行號 ReflectionClass::getEndLine — 獲取最后一行的行數 ReflectionClass::getExtensionName — 獲取定義的類所在的擴展的名稱 ReflectionClass::getExtension — 獲取所在擴展的 ReflectionExtension 對象 ~~~ **內置屬性信息** ~~~ ReflectionClass::getModifiers — 獲取修飾符 ReflectionClass::getName — 獲取類名 ReflectionClass::getNamespaceName — 獲取命名空間的名稱 ReflectionClass::getShortName — 獲取短名 ReflectionClass::getParentClass — 獲取父類 ReflectionClass::getInterfaceNames — 獲取接口(interface)名稱 ReflectionClass::getInterfaces — 獲取接口 ReflectionClass::getConstants — 獲取一組常量 ReflectionClass::getConstant — 獲取定義過的一個常量 ReflectionClass::getStaticProperties — 獲取靜態(static)屬性 ReflectionClass::getStaticPropertyValue — 獲取靜態(static)屬性的值 ReflectionClass::setStaticPropertyValue — 設置靜態屬性的值 ReflectionClass::getProperties — 獲取一組屬性 ReflectionClass::getProperty — 獲取類的一個屬性的 ReflectionProperty ReflectionClass::getDefaultProperties — 獲取默認屬性 ReflectionClass::getConstructor — 獲取類的構造函數 ReflectionClass::getMethods — 獲取方法的數組 ReflectionClass::getMethod — 獲取一個類方法的 ReflectionMethod。 ReflectionClass::getTraits — 返回這個類所使用的 traits 數組 ReflectionClass::getTraitNames — 返回這個類所使用 traits 的名稱的數組 ReflectionClass::getTraitAliases — 返回 trait 別名的一個數組 ~~~ **判斷性操作** ~~~ ReflectionClass::isInternal — 檢查類是否由擴展或核心在內部定義 ReflectionClass::isUserDefined — 檢查是否由用戶定義的 ReflectionClass::inNamespace — 檢查是否位于命名空間中 ReflectionClass::implementsInterface — 接口的實現 ReflectionClass::isSubclassOf — 檢查是否為一個子類 ReflectionClass::isInstance — 檢查類的實例 ReflectionClass::isAbstract — 檢查類是否是抽象類(abstract) ReflectionClass::isFinal — 檢查類是否聲明為 final ReflectionClass::isTrait — 返回了是否為一個 trait ReflectionClass::isCloneable — 返回了一個類是否可復制 ReflectionClass::isInstantiable — 檢查類是否可實例化 ReflectionClass::hasConstant — 檢查常量是否已經定義 ReflectionClass::hasMethod — 檢查方法是否已定義 ReflectionClass::hasProperty — 檢查屬性是否已定義 ~~~ **創建性操作** ~~~ ReflectionClass::newInstance — 從指定的參數創建一個新的類實例 ReflectionClass::newInstanceArgs — 從給出的參數創建一個新的類實例。 ReflectionClass::newInstanceWithoutConstructor — 創建一個新的類實例而不調用它的構造函數 ~~~ ## 4 對象的反射類 ReflectionObject ~~~ ReflectionObject extends ReflectionClass implements Reflector { /* 常量 */ const integer IS_IMPLICIT_ABSTRACT = 16 ; const integer IS_EXPLICIT_ABSTRACT = 32 ; const integer IS_FINAL = 64 ; /* 屬性 */ public $name ; /* 方法 */ public __construct ( object $argument ) public static string export ( string $argument [, bool $return ] ) /* 繼承的方法 */ public ReflectionClass::__construct ( mixed $argument ) public static string ReflectionClass::export ( mixed $argument [, bool $return = false ] ) public mixed ReflectionClass::getConstant ( string $name ) public array ReflectionClass::getConstants ( void ) public ReflectionMethod ReflectionClass::getConstructor ( void ) public array ReflectionClass::getDefaultProperties ( void ) public string ReflectionClass::getDocComment ( void ) public int ReflectionClass::getEndLine ( void ) public ReflectionExtension ReflectionClass::getExtension ( void ) public string ReflectionClass::getExtensionName ( void ) public string ReflectionClass::getFileName ( void ) public array ReflectionClass::getInterfaceNames ( void ) public array ReflectionClass::getInterfaces ( void ) public ReflectionMethod ReflectionClass::getMethod ( string $name ) public array ReflectionClass::getMethods ([ int $filter ] ) public int ReflectionClass::getModifiers ( void ) public string ReflectionClass::getName ( void ) public string ReflectionClass::getNamespaceName ( void ) public object ReflectionClass::getParentClass ( void ) public array ReflectionClass::getProperties ([ int $filter ] ) public ReflectionProperty ReflectionClass::getProperty ( string $name ) public string ReflectionClass::getShortName ( void ) public int ReflectionClass::getStartLine ( void ) public array ReflectionClass::getStaticProperties ( void ) public mixed ReflectionClass::getStaticPropertyValue ( string $name [, mixed &$def_value ] ) public array ReflectionClass::getTraitAliases ( void ) public array ReflectionClass::getTraitNames ( void ) public array ReflectionClass::getTraits ( void ) public bool ReflectionClass::hasConstant ( string $name ) public bool ReflectionClass::hasMethod ( string $name ) public bool ReflectionClass::hasProperty ( string $name ) public bool ReflectionClass::implementsInterface ( string $interface ) public bool ReflectionClass::inNamespace ( void ) public bool ReflectionClass::isAbstract ( void ) public bool ReflectionClass::isCloneable ( void ) public bool ReflectionClass::isFinal ( void ) public bool ReflectionClass::isInstance ( object $object ) public bool ReflectionClass::isInstantiable ( void ) public bool ReflectionClass::isInterface ( void ) public bool ReflectionClass::isInternal ( void ) public bool ReflectionClass::isIterateable ( void ) public bool ReflectionClass::isSubclassOf ( string $class ) public bool ReflectionClass::isTrait ( void ) public bool ReflectionClass::isUserDefined ( void ) public object ReflectionClass::newInstance ( mixed $args [, mixed $... ] ) public object ReflectionClass::newInstanceArgs ([ array $args ] ) public object ReflectionClass::newInstanceWithoutConstructor ( void ) public void ReflectionClass::setStaticPropertyValue ( string $name , string $value ) public string ReflectionClass::__toString ( void ) } ~~~ > 屬性 對象的類名 ` name 只讀` > 方法 (重寫) ~~~ ReflectionObject::__construct — 構造對象 ReflectionObject ReflectionObject::export — 導出對象 ~~~ 其他常量,方法繼承 ReflectionClass類的靜態方法 * * * * * ## 5 方法的反射類 ReflectionMethod ~~~ ReflectionMethod extends ReflectionFunctionAbstract implements Reflector { /* 常量 */ const integer IS_STATIC = 1 ; const integer IS_PUBLIC = 256 ; const integer IS_PROTECTED = 512 ; const integer IS_PRIVATE = 1024 ; const integer IS_ABSTRACT = 2 ; const integer IS_FINAL = 4 ; /* 屬性 */ public $name ; public $class ; /* 方法 */ public __construct ( mixed $class , string $name ) public static string export ( string $class , string $name [, bool $return = false ] ) public Closure getClosure ( object $object ) public ReflectionClass getDeclaringClass ( void ) public int getModifiers ( void ) public ReflectionMethod getPrototype ( void ) public mixed invoke ( object $object [, mixed $parameter [, mixed $... ]] ) public mixed invokeArgs ( object $object , array $args ) public bool isAbstract ( void ) public bool isConstructor ( void ) public bool isDestructor ( void ) public bool isFinal ( void ) public bool isPrivate ( void ) public bool isProtected ( void ) public bool isPublic ( void ) public bool isStatic ( void ) public void setAccessible ( bool $accessible ) public string __toString ( void ) /* 繼承的方法 */ final private void ReflectionFunctionAbstract::__clone ( void ) public ReflectionClass ReflectionFunctionAbstract::getClosureScopeClass ( void ) public object ReflectionFunctionAbstract::getClosureThis ( void ) public string ReflectionFunctionAbstract::getDocComment ( void ) public int ReflectionFunctionAbstract::getEndLine ( void ) public ReflectionExtension ReflectionFunctionAbstract::getExtension ( void ) public string ReflectionFunctionAbstract::getExtensionName ( void ) public string ReflectionFunctionAbstract::getFileName ( void ) public string ReflectionFunctionAbstract::getName ( void ) public string ReflectionFunctionAbstract::getNamespaceName ( void ) public int ReflectionFunctionAbstract::getNumberOfParameters ( void ) public int ReflectionFunctionAbstract::getNumberOfRequiredParameters ( void ) public array ReflectionFunctionAbstract::getParameters ( void ) public string ReflectionFunctionAbstract::getShortName ( void ) public int ReflectionFunctionAbstract::getStartLine ( void ) public array ReflectionFunctionAbstract::getStaticVariables ( void ) public bool ReflectionFunctionAbstract::inNamespace ( void ) public bool ReflectionFunctionAbstract::isClosure ( void ) public bool ReflectionFunctionAbstract::isDeprecated ( void ) public bool ReflectionFunctionAbstract::isGenerator ( void ) public bool ReflectionFunctionAbstract::isInternal ( void ) public bool ReflectionFunctionAbstract::isUserDefined ( void ) public bool ReflectionFunctionAbstract::isVariadic ( void ) public bool ReflectionFunctionAbstract::returnsReference ( void ) abstract public void ReflectionFunctionAbstract::__toString ( void ) } ~~~ > 屬性 ~~~ name 方法名稱 ~~~ ~~~ class 類名稱 ~~~ > 預定義常量 ~~~ ReflectionMethod::IS_STATIC 指示一個方法是靜態(static)的。 ReflectionMethod::IS_PUBLIC 指示一個方法是 public 的。 ReflectionMethod::IS_PROTECTED 指示一個方法是 protected 的。 ReflectionMethod::IS_PRIVATE 指示一個方法是 private 的。 ReflectionMethod::IS_ABSTRACT 指示一個方法是 abstract 的。 ReflectionMethod::IS_FINAL 指示一個方法是 final 的。 ~~~ > 方法 **屬性信息** ~~~ ReflectionMethod::getDeclaringClass — 獲取反射函數調用參數的類表達 ReflectionMethod::getModifiers — 獲取方法的修飾符 ReflectionMethod::getPrototype — 返回方法原型 (如果存在) ~~~ **調用操作** ~~~ ReflectionMethod::invoke — Invoke ReflectionMethod::invokeArgs — 帶參數執行 ~~~ **判斷操作** ~~~ ReflectionMethod::isAbstract — 判斷方法是否是抽象方法 ReflectionMethod::isConstructor — 判斷方法是否是構造方法 ReflectionMethod::isDestructor — 判斷方法是否是析構方法 ReflectionMethod::isFinal — 判斷方法是否定義 final ReflectionMethod::isPrivate — 判斷方法是否是私有方法 ReflectionMethod::isProtected — 判斷方法是否是保護方法 (protected) ReflectionMethod::isPublic — 判斷方法是否是公開方法 ReflectionMethod::isStatic — 判斷方法是否是靜態方法 ReflectionMethod::setAccessible — 設置方法是否訪問 ~~~ **其他操作** ~~~ ReflectionMethod::__construct — ReflectionMethod 的構造函數 ReflectionMethod::__toString — 返回反射方法對象的字符串表達 ReflectionMethod::__toString — 返回反射方法對象的字符串表達 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看