uTools-Manuals/docs/php/halt_compiler.html
2019-04-28 19:00:34 +08:00

67 lines
4.1 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>中断编译器的执行</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.halt-compiler" class="refentry">
<div class="refnamediv">
<h1 class="refname">__halt_compiler</h1>
<p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7)</p><p class="refpurpose"><span class="refname">__halt_compiler</span> &mdash; <span class="dc-title">
中断编译器的执行
</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.halt-compiler-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>__halt_compiler</strong></span>
( <span class="methodparam">void</span>
) : <span class="type"><span class="type void">void</span></span></div>
<p class="para rdfs-comment">
中断编译器的执行。常用于在PHP脚本内嵌入数据类似于安装文件。
</p>
<p class="para">
可以通过常量 <strong><code>__COMPILER_HALT_OFFSET__</code></strong> 获取数据开始字节所在的位置且该常量仅被定义于使用了__halt_compiler的文件。
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.halt-compiler-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
没有返回值。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.halt-compiler-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4539">
<p><strong>Example #1 <span class="function"><strong>__halt_compiler()</strong></span> 例子</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;open&nbsp;this&nbsp;file<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'r'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;seek&nbsp;file&nbsp;pointer&nbsp;to&nbsp;data<br /></span><span style="color: #0000BB">fseek</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">__COMPILER_HALT_OFFSET__</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;and&nbsp;output&nbsp;it<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">stream_get_contents</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;script&nbsp;execution<br /></span><span style="color: #007700">__halt_compiler();&nbsp;</span><span style="color: #0000BB">the&nbsp;installation&nbsp;data&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">eg</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">tar</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">gz</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PHP</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">etc</span><span style="color: #007700">.)</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.halt-compiler-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
<span class="function"><strong>__halt_compiler()</strong></span> 仅能够在最外层使用。
</p>
</p></blockquote>
</div>
</div></div></div></body></html>