1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-30 11:02:18 +02:00
Files
archived-doc-ja/reference/exec/functions/escapeshellcmd.xml
TAKAGI Masahiro fb5cd70a53 sync with en.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@200348 c90b9560-bf6c-de11-be94-00142212c4b1
2005-11-10 21:51:39 +00:00

116 lines
3.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.7 $ -->
<!-- EN-Revision: 1.8 Maintainer: hirokawa Status: ready -->
<!-- splitted from ./en/functions/exec.xml, last change in rev 1.2 -->
<!-- CREDITS: shimooka,takagi -->
<refentry id="function.escapeshellcmd">
<refnamediv>
<refname>escapeshellcmd</refname>
<refpurpose>シェルのメタ文字をエスケープする</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>escapeshellcmd</methodname>
<methodparam><type>string</type><parameter>command</parameter></methodparam>
</methodsynopsis>
<para>
<function>escapeshellcmd</function> は、文字列中においてシェルコマンドを
だまして勝手なコマンドを実行する可能性がある文字をエスケープします。
この関数は、ユーザに入力されたデータを関数
<function>exec</function> または <function>system</function> または、
<link linkend="language.operators.execution">バックティック演算子</link>
に渡す前に全てエスケープを行う場合に使用するべきです。
</para>
<para>
<literal>#&amp;;`|*?~&lt;&gt;^()[]{}$\</literal><literal>\x0A</literal>
および <literal>\xFF</literal> については、その文字の前にバックスラッシュが
追加されます。<literal>'</literal> および <literal>"</literal>
は、対になっていない場合にのみエスケープされます。Windows では、
これらの文字に加えて <literal>%</literal> がスペースに置き換えられます。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>command</parameter></term>
<listitem>
<para>
エスケープされるコマンド
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
エスケープされた文字列
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>escapeshellcmd</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$e = escapeshellcmd($userinput);
// ここでは $e がスペースを含んでいても関係ない
system("echo $e");
$f = escapeshellcmd($filename);
// ここでは気を遣い、クォートを使用する
system("touch \"/tmp/$f\"; ls -l \"/tmp/$f\"");
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>escapeshellarg</function></member>
<member><function>exec</function></member>
<member><function>popen</function></member>
<member><function>system</function></member>
<member><link linkend="language.operators.execution">バックティック演算子</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:"../../../../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
-->