uTools-Manuals/docs/php/runkit_import.html
2019-04-08 23:22:26 +08:00

94 lines
4.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Process a PHP file importing function and class definitions, overwriting where appropriate</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.runkit-import" class="refentry">
<div class="refnamediv">
<h1 class="refname">runkit_import</h1>
<p class="verinfo">(PECL runkit &gt;= 0.7.0)</p><p class="refpurpose"><span class="refname">runkit_import</span> &mdash; <span class="dc-title">
Process a PHP file importing function and class definitions, overwriting where appropriate
</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.runkit-import-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>runkit_import</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = RUNKIT_IMPORT_CLASS_METHODS</span></span>
] ) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
Similar to <span class="function"><a href="include.html" class="function">include</a></span> however any code residing outside
of a function or class is simply ignored.
Additionally, depending on the value of <code class="parameter">flags</code>,
any functions or classes which already exist in the currently running environment
may be automatically overwritten by their new definitions.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.runkit-import-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">filename</code></dt>
<dd>
<p class="para">
Filename to import function and class definitions from
</p>
</dd>
<dt>
<code class="parameter">flags</code></dt>
<dd>
<p class="para">
Bitwise OR of the <a href="runkit.constants.html" class="link"><em>RUNKIT_IMPORT_*</em>
family of constants</a>.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.runkit-import-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.runkit-import-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-552">
<p><strong>Example #1 <span class="function"><strong>runkit_import()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;import&nbsp;classes&nbsp;entirely<br /></span><span style="color: #0000BB">runkit_import</span><span style="color: #007700">(</span><span style="color: #DD0000">'myfile.inc'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">RUNKIT_IMPORT_CLASSES</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;import&nbsp;classes,&nbsp;but&nbsp;not&nbsp;imports&nbsp;their&nbsp;static&nbsp;properties<br />&nbsp;&nbsp;&nbsp;(RUNKIT_IMPORT_CLASS_STATIC_PROPS&nbsp;is&nbsp;available&nbsp;since&nbsp;1.0.1)&nbsp;*/<br /></span><span style="color: #0000BB">runkit_import</span><span style="color: #007700">(</span><span style="color: #DD0000">'myfile.inc'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">RUNKIT_IMPORT_CLASSES&nbsp;</span><span style="color: #007700">&amp;&nbsp;~</span><span style="color: #0000BB">RUNKIT_IMPORT_CLASS_STATIC_PROPS</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;import&nbsp;only&nbsp;static&nbsp;properties&nbsp;of&nbsp;classes<br />&nbsp;&nbsp;&nbsp;(RUNKIT_IMPORT_CLASS_STATIC_PROPS&nbsp;is&nbsp;available&nbsp;since&nbsp;1.0.1)&nbsp;*/<br /></span><span style="color: #0000BB">runkit_import</span><span style="color: #007700">(</span><span style="color: #DD0000">'myfile.inc'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">RUNKIT_IMPORT_CLASS_STATIC_PROPS</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
</div></div></div></body></html>