2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-11-01 16:40:58 +00:00
|
|
|
<!-- $Revision: 1.7 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/exec.xml, last change in rev 1.8 -->
|
|
|
|
<refentry id="function.escapeshellarg">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>escapeshellarg</refname>
|
2004-08-19 12:14:46 +00:00
|
|
|
<refpurpose>Escape a string to be used as a shell argument</refpurpose>
|
2002-04-15 00:12:54 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
2004-11-01 16:40:58 +00:00
|
|
|
&reftitle.description;
|
2002-04-15 00:12:54 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>escapeshellarg</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>arg</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
<function>escapeshellarg</function> adds single quotes around a string
|
|
|
|
and quotes/escapes any existing single quotes allowing you to pass a
|
|
|
|
string directly to a shell function and having it be treated as a single
|
|
|
|
safe argument. This function should be used to escape individual
|
|
|
|
arguments to shell functions coming from user input. The shell functions
|
|
|
|
include <function>exec</function>, <function>system</function> and the
|
|
|
|
<link linkend="language.operators.execution">backtick operator</link>.
|
|
|
|
A standard use would be:</para>
|
|
|
|
<para>
|
|
|
|
<informalexample>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
2003-06-16 19:43:41 +00:00
|
|
|
<?php
|
|
|
|
system('ls '.escapeshellarg($dir));
|
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
</para>
|
|
|
|
<para>
|
2003-10-31 15:46:07 +00:00
|
|
|
See also <function>escapeshellcmd</function>, <function>exec</function>,
|
2003-06-16 19:43:41 +00:00
|
|
|
<function>popen</function>, <function>system</function>, and the <link
|
2002-04-15 00:12:54 +00:00
|
|
|
linkend="language.operators.execution">backtick operator</link>.
|
|
|
|
</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:"../../../../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
|
|
|
|
-->
|