This commit is contained in:
fofolee
2019-04-28 19:00:34 +08:00
parent a895309fba
commit f782158fb7
4705 changed files with 471929 additions and 471947 deletions

View File

@@ -1,104 +1,104 @@
<!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>通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回。</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.shell-exec" class="refentry">
<div class="refnamediv">
<h1 class="refname">shell_exec</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">shell_exec</span> &mdash; <span class="dc-title">通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回。</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.shell-exec-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>shell_exec</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$cmd</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
本函数同 <a href="language.operators.execution.html" class="link">执行操作符</a>
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.shell-exec-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">cmd</code></dt>
<dd>
<p class="para">
要执行的命令。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.shell-exec-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
命令执行的输出。
如果执行过程中发生错误或者进程不产生输出,则返回 <strong><code>NULL</code></strong>
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
当进程执行过程中发生错误,或者进程不产生输出的情况下,都会返回 <strong><code>NULL</code></strong>
所以,使用本函数无法通过返回值检测进程是否成功执行。
如果需要检查进程执行的退出码,请使用 <span class="function"><a href="exec.html" class="function">exec()</a></span> 函数。
</p>
</p></blockquote>
</div>
<div class="refsect1 examples" id="refsect1-function.shell-exec-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4362">
<p><strong>Example #1 <span class="function"><strong>shell_exec()</strong></span> 例程</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$output&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">shell_exec</span><span style="color: #007700">(</span><span style="color: #DD0000">'ls&nbsp;-lart'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;pre&gt;</span><span style="color: #0000BB">$output</span><span style="color: #DD0000">&lt;/pre&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.shell-exec-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
当 PHP 运行在 <a href="features.safe_mode.html" class="link">安全模式</a> 时,不能使用此函数。
</p>
</p></blockquote>
</div>
<div class="refsect1 seealso" id="refsect1-function.shell-exec-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="exec.html" class="function" rel="rdfs-seeAlso">exec()</a> - 执行一个外部程序</span></li>
<li class="member"><span class="function"><a href="escapeshellcmd.html" class="function" rel="rdfs-seeAlso">escapeshellcmd()</a> - shell 元字符转义</span></li>
</ul>
</p>
</div>
<!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>通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回。</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.shell-exec" class="refentry">
<div class="refnamediv">
<h1 class="refname">shell_exec</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">shell_exec</span> &mdash; <span class="dc-title">通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回。</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.shell-exec-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>shell_exec</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$cmd</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
本函数同 <a href="language.operators.execution.html" class="link">执行操作符</a>
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.shell-exec-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">cmd</code></dt>
<dd>
<p class="para">
要执行的命令。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.shell-exec-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
命令执行的输出。
如果执行过程中发生错误或者进程不产生输出,则返回 <strong><code>NULL</code></strong>
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
当进程执行过程中发生错误,或者进程不产生输出的情况下,都会返回 <strong><code>NULL</code></strong>
所以,使用本函数无法通过返回值检测进程是否成功执行。
如果需要检查进程执行的退出码,请使用 <span class="function"><a href="exec.html" class="function">exec()</a></span> 函数。
</p>
</p></blockquote>
</div>
<div class="refsect1 examples" id="refsect1-function.shell-exec-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4362">
<p><strong>Example #1 <span class="function"><strong>shell_exec()</strong></span> 例程</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$output&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">shell_exec</span><span style="color: #007700">(</span><span style="color: #DD0000">'ls&nbsp;-lart'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;pre&gt;</span><span style="color: #0000BB">$output</span><span style="color: #DD0000">&lt;/pre&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.shell-exec-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
当 PHP 运行在 <a href="features.safe_mode.html" class="link">安全模式</a> 时,不能使用此函数。
</p>
</p></blockquote>
</div>
<div class="refsect1 seealso" id="refsect1-function.shell-exec-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="exec.html" class="function" rel="rdfs-seeAlso">exec()</a> - 执行一个外部程序</span></li>
<li class="member"><span class="function"><a href="escapeshellcmd.html" class="function" rel="rdfs-seeAlso">escapeshellcmd()</a> - shell 元字符转义</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>