mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-24 15:12:23 +01:00
115 lines
3.2 KiB
XML
115 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 7973fd533364af4dd6282ca9e7bee2dffec39b1c Maintainer: leonardolara Status: ready --><!-- CREDITS: fernandoc,leonardolara -->
|
|
<!-- splitted from ./en/functions/exec.xml, last change in rev 1.2 -->
|
|
<refentry xml:id="function.shell-exec" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>shell_exec</refname>
|
|
<refpurpose>Executa um comando via shell e retorna a saída inteira como uma string</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>string</type><type>false</type><type>null</type></type><methodname>shell_exec</methodname>
|
|
<methodparam><type>string</type><parameter>command</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Esta função é identica ao <link linkend="language.operators.execution">operador de execução</link>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
No Windows, o tubo subjacente é aberto em modo texto o que pode fazer com
|
|
que a função falhe para saída binária. Considere usar <function>popen</function>
|
|
alternativamente para estes casos.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>command</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
O comando que será executado.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Uma &string; contendo a saída do comando executado, &false; se o tubo
|
|
não puder ser estabelecido ou &null; se um erro ocorrer ou o comando não gerar saída.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Esta função pode retornar &null; quando um erro ocorre ou quando o programa
|
|
não produz saída. Não é possível detectar falhas de execução usando
|
|
esta função. <function>exec</function> deve ser usada quando o acesso ao
|
|
código de saída do programa é requerido.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Um erro de nível <constant>E_WARNING</constant> é gerado
|
|
quando o tubo não puder ser estabelecido.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Um exemplo de <function>shell_exec</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$output = shell_exec('ls -lart');
|
|
echo "<pre>$output</pre>";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>exec</function></member>
|
|
<member><function>escapeshellcmd</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|