PHP reverse image API

Source: Internet
Author: User
Tags reflector
What is PHP Reflection API reflection? It refers to the extension analysis of PHP programs in the PHP running state, exporting or extracting detailed information about classes, methods, attributes, parameters, and so on, including comments. This kind of dynamic information and the function of dynamically calling an object is called a Reflection API. Reflection API Overview: classReflection {} interfaceR PHP Reflection API
What is reflection?
It refers to the extension analysis of PHP programs in the PHP running state, exporting or extracting detailed information about classes, methods, attributes, parameters, and so on, including comments. This kind of dynamic information and the function of dynamically calling an object is called a Reflection API.
Reflection API overview: class Reflection {} interface Reflector {} class ReflectionException extends Exception {} class ReflectionFunction implements Reflector {} class extends implements Reflector {} class ReflectionMethod extends ReflectionFunction {} class implements Reflector ctor {} extends ReflectionClass {} class ReflectionProperty implements Reflector {} class ReflectionExtension implements Reflector {} (for example, see The php Manual) ① Reflection class Reflection {public static mixed export (Reflector r [, bool return]) // export the details of a class or method public static array getModifierNames (int modifiers) // Get the modifier name} ② ReflectionException class this class inherits the standard class without special methods and attributes. ③ ReflectionFunction class ReflectionFunction implements Reflector {final private _ clone () public object _ construct (string name) public string _ toString () public static string export () // export the detailed information of the function public string getName () // Obtain the function name public bool isInternal () // test whether the function is public bool isUserDefined () // test whether the user-defined function is public string getFileName () // Obtain the file name, including the path name public int getStartLine () // Obtain the start line public int getEndLine () of the defined function () // get the end line of the defined function public string getDocComment () // Get the comments of the function public array getStaticVariables () // Get the static variable public mixed invoke (mixed * args) // call this function by passing the public mixed invokeArgs (array args) parameter in the parameter list // call this function by passing the public bool returnsReference () parameter in the array () // test whether the function returns the parameter required to reference public ReflectionParameter [] getParameters () // to obtain the method. the returned value is the object array public int getNumberOfParameters () // Obtain the number of parameters required for this method public int getNumberOfRequiredParameters () // Obtain the number of parameters required for this method} ④ ReflectionParameter class: class ReflectionParameter implements Reflector ctor {final private _ clone () public object _ construct (string name) public string _ toString () public static string export () // export the details of this parameter public string getName () // Obtain the parameter name public bool isPassedByReference () // test whether the public ReflectionClass getClass () parameter is passed by reference. // if the parameter is an object, return the class name of this object public bool isArray () // test whether this parameter is of the array type public bool allowsNull () // test whether this parameter allows null public bool isOptional () // test whether this parameter is optional. if there is a default parameter, public bool isdefavaluvalueavailable () // test whether this parameter is the default parameter public mixed getDefaultValue () // Obtain the default value of this parameter} ⑤ ReflectionClass: class ReflectionClass implements Reflector ctor {final private _ clone () public object _ construct (string name) public string _ toString () public static string export () // export the detailed information of this class public string getName () // Obtain the class name or interface name public bool isInternal () // test whether the class is a system internal class public bool isUserDefined () // test whether the class is a user-defined class public bool isInstantiable () // test whether the class has been instantiated public bool hasConstant (string name) // test whether the class has a specific constant public bool hasMethod (string name) // test whether the class has a specific method public bool hasProperty (string name) // test whether the class has a specific attribute public string getFileName () // Obtain the name of the file defining the class, include the pathname public int getStartLine () // get the start line of the defined class public int getEndLine () // get the end line of the defined class public string getDocComment () // Obtain the comments of this class public ReflectionMethod getConstructor () // Obtain the constructor information of this class public ReflectionMethod getMethod (string name) // Obtain a specific method information of the class public ReflectionMethod [] getMethods () // obtain all the methods information of the class public ReflectionProperty getProperty (string name) // Obtain a specific attribute information public ReflectionProperty [] getProperties () // Obtain all attribute information of this class public array getConstants () // obtain all the constant information of this class public mixed getConstant (string name) // Obtain the specific constant information of this class public ReflectionClass [] getInterfaces () // Obtain the interface class information public bool isInterface () // test whether the class is an interface public bool isAbstract () // test whether the class is an abstract class public bool isFinal () // test whether the class is declared as finalpublic int getModifiers () // Get the modifier of this class. the returned value type may be a resource type // read public bool isInstance (stdclass object) further through Reflection: getModifierNames ($ class-> getModifiers) // test whether the input object is an instance of the class public stdclass newInstance (mixed * args) // create the instance public ReflectionClass getParentClass () // Obtain the parent class public bool isSubclassOf (ReflectionClass class) // test whether the passed class is the class's parent class public array getStaticProperties () // obtain all the static attributes of the class public mixed getStaticPropertyValue (string name [, mixed default]) // Obtain the static attribute values of the class. if private, public void setStaticPropertyValue (string name, mixed value) is not accessible. // you can set the static attribute values of this class. if private, the static attribute values are not accessible. the encapsulation principle is invalid. public array getDefaultProperties () // Obtain the attribute information of this class, excluding the static attribute public bool isIterateable () public bool implementsInterface (string name) // test whether a specific interface public ReflectionExtension getExtension () is implemented () public string getExtensionName ()} ⑥ ReflectionMethod class: class ReflectionMethod extends ReflectionFunction {public _ construct (mixed class, string name) public string _ toString () public static string export () // export the information of this method public mixed invoke (stdclass object, mixed * args) // call this method public mixed invokeArgs (stdclass object, array args) // call this method, pass the multi-parameter public bool isFinal () // test whether the method is finalpublic bool isAbstract () // test whether the method is abstractpublic bool isPublic () // test whether the method is publicpublic bool isPrivate () // test whether the method is privatepublic bool isProtected () // test whether the method is protectedpublic bool isStatic () // test whether the method is staticpublic bool isConstructor () // test whether the method is a constructor public bool isDestructor () // test whether the method is the destructor public int getModifiers () // Get the modifier public ReflectionClass getDeclaringClass () // Obtain the class to which the method belongs // Inherited from ReflectionFunctionfinal private _ clone () public string getName () public bool isInternal () public bool isUserDefined () public string getFileName () public int getStartLine () public int getEndLine () public string getDocComment () public array getStaticVariables () public bool returnsReference () public ReflectionParameter [] getParameters () public int getNumberOfParameters () public int getNumberOfRequiredParameters ()} 7reflectionproperty class: class ReflectionProperty implements Reflector ctor {final private _ clone () public _ construct (mixed class, string name) public string _ toString () public static string export () // export the details of this attribute public string getName () // Obtain the attribute name public bool isPublic () // test whether the attribute name is publicpublic bool isPrivate () // test whether the attribute name is privatepublic bool isProtected () // test whether the attribute name is protectedpublic bool isStatic () // test whether the attribute name is staticpublic bool isDefault () public int getModifiers () // Get the modifier public mixed getValue (stdclass object) // Obtain the public void setValue (stdclass object, mixed value) of this attribute // set the public ReflectionClass getDeclaringClass () // Obtain the public string getDocComment () class that defines this attribute () // Get the annotation of this attribute} extends ReflectionExtension class ReflectionExtension implements Reflector ctor {final private _ clone () public _ construct (string name) public string _ toString () public static string export () // export all information about the extension public string getName () // Obtain the extension name public string getVersion () // Obtain the public ReflectionFunction [] getFunctions () of the extension // obtain all the functions of the extension public array getConstants () // obtain all the constants of the extension public array getINIEntries () // Obtain the extension-related information in php. the command information in ini is public ReflectionClass [] getClasses () public array getClassNames ()}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.