1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-24 07:22:16 +01:00
Files
archived-doc-es/reference/exec/functions/exec.xml
2021-01-29 00:06:05 -05:00

140 lines
4.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: yago Status: ready -->
<!-- splitted from ./en/functions/exec.xml, last change in rev 1.2 -->
<refentry xml:id="function.exec" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>exec</refname>
<refpurpose>Ejecutar un programa externo</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>exec</methodname>
<methodparam><type>string</type><parameter>command</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter role="reference">output</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter role="reference">return_var</parameter></methodparam>
</methodsynopsis>
<para>
<function>exec</function> ejecuta el <parameter>comando</parameter>
dado.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>command</parameter></term>
<listitem>
<para>
El comando que será ejecutado.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>output</parameter></term>
<listitem>
<para>
Si el argumento <parameter>output</parameter> está presente, entonces
el array especificado será llenado con cada línea de la salida del
comando. El espacio en blanco extra, como <literal>\n</literal>, no
es incluido en este array. Note que si el array ya contiene algunos
elementos, <function>exec</function> anexará sus resultados al final
del array. Si no desea que la función anexe los elementos, use
<function>unset</function> sobre el array antes de pasarla a
<function>exec</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>return_var</parameter></term>
<listitem>
<para>
Si el argumento <parameter>return_var</parameter> está presente
junto con el argumento <parameter>output</parameter>, entonces el
status de retorno del comando ejecutado será escrito en esta
variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
La última línea de los resultados del comando. Si necesita ejecutar un
comando y tener todos los datos desde el comando pasados directamente de
vuelta sin interferencia alguna, use la función
<function>passthru</function>.
</para>
<para>
Para obtener la salida del comando ejecutado, asegúrese de definir y usar
el parámetro <parameter>output</parameter>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Un ejemplo de <function>exec</function></title>
<programlisting role="php">
<![CDATA[
<?php
// imprime el nombre de usuario que tiene control del proceso php/httpd activo
// (en un sistema con el ejecutable "whoami" disponible en la ruta)
echo exec('whoami');
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&warn.escapeshell;
&note.exec-bg;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>system</function></member>
<member><function>passthru</function></member>
<member><function>escapeshellcmd</function></member>
<member><function>pcntl_exec</function></member>
<member><link linkend="language.operators.execution">operador de
comilla invertida</link></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
-->