Reflection--映像

来源:互联网 发布:yyf的神秘商店是淘宝嘛 编辑:程序博客网 时间:2024/04/28 13:01

Reflection--映像

Table of Contents

内容目录

  • Introduction
  • 介绍
  • The Reflector interface
  • 映射接口
  • The ReflectionException class
  • 映射例外类
  • The ReflectionFunction class
  • 映射方法类
  • The ReflectionParameter class
  • 映射参数类
  • The ReflectionClass class
  • 映射基本类
  • The ReflectionObject class
  • 映射对象类
  • The ReflectionMethod class
  • 映射方法类
  • The ReflectionProperty class
  • 映射属性类
  • The ReflectionExtension class
  • 映射扩展类
  • Extending the reflection classes
  • 扩展映射类

Introduction

介绍

 

       PHP 5 comes with a complete reflection API that adds the ability to reverse-engineer classes, interfaces, functions and methods as well as extensions. Additionally, the reflection API also offers ways of retrieving doc comments for functions, classes and methods.

       PHP 5 提供了一个完整的反转类、接口、函数和方法还有扩展类的API.映射API还提供了为函数、类和方法弥补注释文档的方法。

       The reflection API is an object-oriented extension to the Zend Engine, consisting of the following classes:

       映射API是一个对Zend引擎的面向对象的扩展,看一下下面的类:

      

 

 

Note: For details on these classes, have a look at the next chapters.

注意:对与这些类的详细解释,需要看下一篇文章

 

If we were to execute the code in the example below:

如果我们执行了下面的代码:

 

将会输出:

 

Reflector

映射器(反射器)


Reflector is an interface implemented by all exportable Reflection classes.

映射器是所有映射类输出的一个接口实现

 

ReflectionException

映射例外


ReflectionException extends the standard Exception and is thrown by Reflection API. No specific methods or properties are introduced.

映射例外是由映射API抛出的对标准例外的扩展。没有引入具体的方法和属性。

ReflectionFunction

映射函数


The ReflectionFunction class lets you reverse-engineer functions.

映射函数类让你有了反转引擎函数。

 

 

To introspect a function, you will first have to create an instance of the ReflectionFunction class. You can then call any of the above methods on this instance.

为了内省一个函数,首先你需要去建立一个映射类的实例。然后你就可以调用这个实例里的任何方法了。

 

 

 

 

原创粉丝点击