mirror of
https://github.com/php/doc-ja.git
synced 2026-03-24 23:22:16 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@325742 c90b9560-bf6c-de11-be94-00142212c4b1
125 lines
4.0 KiB
XML
125 lines
4.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 4d81bf20250c93fdfb7b114c5d8abe13f311fba4 Maintainer: takagi Status: ready -->
|
|
<!-- splitted from ./en/functions/exec.xml, last change in rev 1.2 -->
|
|
<!-- CREDITS: hirokawa,shimooka -->
|
|
<refentry xml:id="function.escapeshellcmd" xmlns="http://docbook.org/ns/docbook">
|
|
<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>#&;`|*?~<>^()[]{}$\</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
|
|
// 意図的に、任意の数の引数を指定できるようにしています
|
|
$command = './configure '.$_POST['configure_options'];
|
|
|
|
$escaped_command = escapeshellcmd($command);
|
|
|
|
system($escaped_command);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
<warning xmlns="http://docbook.org/ns/docbook">
|
|
<para>
|
|
<function>escapeshellcmd</function>
|
|
はコマンド文字列全体に適用しなければなりません。
|
|
また、そうしたところで、まだ任意の数の引数を渡すことによる攻撃を許してしまいます。
|
|
単一の引数をエスケープするには、かわりに <function>escapeshellarg</function>
|
|
を使わねばなりません。
|
|
</para>
|
|
</warning>
|
|
</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:"~/.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
|
|
-->
|