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

92 lines
3.9 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>返回删除注释和空格后的PHP源码</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.php-strip-whitespace" class="refentry">
<div class="refnamediv">
<h1 class="refname">php_strip_whitespace</h1>
<p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">php_strip_whitespace</span> &mdash; <span class="dc-title">返回删除注释和空格后的PHP源码</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.php-strip-whitespace-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>php_strip_whitespace</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
返回删除注释和空格后 <code class="parameter">filename</code> 的PHP源码。这对实际代码数量和注释数量的对比很有用。
此函数与 <a href="features.commandline.html" class="link">命令行</a> 下执行 <strong class="command">php -w</strong> 相似。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.php-strip-whitespace-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">filename</code></dt>
<dd>
<p class="para">
PHP文件的路径。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.php-strip-whitespace-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
在成功时返回过滤后的代码,或者在失败时返回空字符串。
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
此函数在PHP 5.0.1后以所述方式工作。之前它仅会返回一个空字符串。关于更多此BUG的信息与其行为详见BUG报告 <a href="http://bugs.php.net/29606" class="link external">&raquo;&nbsp;#29606</a>
</p>
</p></blockquote>
</div>
<div class="refsect1 examples" id="refsect1-function.php-strip-whitespace-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4544">
<p><strong>Example #1 <span class="function"><strong>php_strip_whitespace()</strong></span> 的例子</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;PHP&nbsp;comment&nbsp;here<br /><br />/*<br />&nbsp;*&nbsp;Another&nbsp;PHP&nbsp;comment<br />&nbsp;*/<br /><br /></span><span style="color: #007700">echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">php_strip_whitespace</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Newlines&nbsp;are&nbsp;considered&nbsp;whitespace,&nbsp;and&nbsp;are&nbsp;removed&nbsp;too:<br /></span><span style="color: #0000BB">do_nothing</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
&lt;?php
echo php_strip_whitespace(__FILE__); do_nothing(); ?&gt;
</pre></div>
</div>
<div class="example-contents"><p>
可以注意到PHP的注释已不存在成为第一个echo语句前的换行和空格。
</p></div>
</div>
</p>
</div>
</div></div></div></body></html>