⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 language.oop5.reflection.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Reflection</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.oop5.object-comparison.html">Comparing objects</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.oop5.typehinting.html">Type Hinting</a></div> <div class="up"><a href="language.oop5.html">Classes and Objects (PHP 5)</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="language.oop5.reflection" class="sect1">  <h2 class="title">Reflection</h2>  <div id="language.oop5.reflection.toc" class="sect2">   <h3 class="title">Table of Contents</h3>   <ul class="simplelist">    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.introduction" class="link">Introduction</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflector" class="link">The Reflector interface</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionexception" class="link">The ReflectionException class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionfunction" class="link">The ReflectionFunction class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionparameter" class="link">The ReflectionParameter class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionclass" class="link">The ReflectionClass class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionobject" class="link">The ReflectionObject class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionmethod" class="link">The ReflectionMethod class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionproperty" class="link">The ReflectionProperty class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.reflectionextension" class="link">The ReflectionExtension class</a></li>    <li class="member"><a href="language.oop5.reflection.html#language.oop5.reflection.extending" class="link">Extending the reflection classes</a></li>   </ul>  </div>  <div id="language.oop5.reflection.introduction" class="sect2">   <h3 class="title">Introduction</h3>   <p class="para">    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.   </p>   <p class="para">    The reflection API is an object-oriented extension to the Zend Engine,    consisting of the following classes:   </p>   <div class="informalexample">    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">Reflection&nbsp;</span><span style="color: #007700">{&nbsp;}<br />interface&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionException&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">Exception&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionFunction&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">ReflectionFunctionAbstract&nbsp;</span><span style="color: #007700">implements&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionParameter&nbsp;</span><span style="color: #007700">implements&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionMethod&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">ReflectionFunctionAbstract&nbsp;</span><span style="color: #007700">implements&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionClass&nbsp;</span><span style="color: #007700">implements&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionObject&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">ReflectionClass&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionProperty&nbsp;</span><span style="color: #007700">implements&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br />class&nbsp;</span><span style="color: #0000BB">ReflectionExtension&nbsp;</span><span style="color: #007700">implements&nbsp;</span><span style="color: #0000BB">Reflector&nbsp;</span><span style="color: #007700">{&nbsp;}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>   <blockquote><p><b class="note">Note</b>:     <span class="simpara">     For details on these classes, have a look at the next chapters.    </span>   </p></blockquote>   <p class="para">    If we were to execute the code in the example below:    <div class="example">     <p><b>Example #1 Basic usage of the reflection API</b></p>     <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />Reflection</span><span style="color: #007700">::</span><span style="color: #0000BB">export</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">ReflectionClass</span><span style="color: #007700">(</span><span style="color: #DD0000">'Exception'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>     </div>     <div class="example-contents"><p>The above example will output:</p></div>     <div class="example-contents"><pre><div class="cdata"><pre>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -