mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
92 lines
3.9 KiB
HTML
92 lines
3.9 KiB
HTML
<!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> — <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">» #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"><?php<br /></span><span style="color: #FF8000">// PHP comment here<br /><br />/*<br /> * Another PHP comment<br /> */<br /><br /></span><span style="color: #007700">echo </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">// Newlines are considered whitespace, and are removed too:<br /></span><span style="color: #0000BB">do_nothing</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
<div class="example-contents"><p>以上例程会输出:</p></div>
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
<?php
|
||
echo php_strip_whitespace(__FILE__); do_nothing(); ?>
|
||
</pre></div>
|
||
</div>
|
||
<div class="example-contents"><p>
|
||
可以注意到PHP的注释已不存在,成为第一个echo语句前的换行和空格。
|
||
</p></div>
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |