fujimoto Mon Dec 10 10:13:42 2001 EDT
Modified files:
/phpdoc/ja/appendices commandline.xml
Log:
updated translation (up to 1.6).
Index: phpdoc/ja/appendices/commandline.xml
diff -u phpdoc/ja/appendices/commandline.xml:1.2
phpdoc/ja/appendices/commandline.xml:1.3
--- phpdoc/ja/appendices/commandline.xml:1.2 Sat Nov 10 16:50:05 2001
+++ phpdoc/ja/appendices/commandline.xml Mon Dec 10 10:13:42 2001
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!--
TODO:
@@ -36,7 +36,7 @@
<literal>-h</literal>
オプションを使用することにより、実際のリスト
とその簡単な説明を得ることが可能です。<literal>php -h</literal>
の
出力は、以下のようになります。
- <programlisting>
+ <screen>
<![CDATA[
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]}
-q Quiet-mode. Suppress HTTP Header output.
@@ -53,7 +53,7 @@
-i PHP information
-h This help
]]>
- </programlisting>
+ </screen>
</para>
<para>
以下に最も重要なコマンドラインオプションのいくつかについて詳細な解
@@ -148,17 +148,17 @@
</table>
</para>
<para>
- The PHP executable can be used to run PHP scripts absolutely
- independent from the web server. If you are on a Unix system,
- you should add a special first line to your PHP script, and
- make it executable, so the system will know, what program
- should run the script. On a Windows platform you can associate
- <literal>php.exe -q</literal> with the double click option of
- the <literal>.php</literal> files, or you can make a batch file
- to run the script through PHP. The first line added to the
- script to work on Unix won't hurt on Windows, so you can write
- cross platform programs this way. A simple example of writing
- a command line PHP program can be found below.
+
+PHPの実行形式を使えばPHPをスクリプトをウェブサーバから完全に
+ 独立させて実行することが出来ます。Unixシステム上では、PHP
+
+スクリプトの先頭に特別な1行を追加することで、そのスクリプトを
+
+実行するのに必要なプログラムをシステムに知らせることができるので
+
+そのスクリプト自体を実行可能形式とすることが出来ます。Windows
+ システム上では、<literal>php.exe -q</literal>を<literal>.php
+
+</literal>ファイルに関連付けるか、PHPを使ってスクリプトを実行する
+
+バッチファイルを書くことが出来ます。Unixでの実行のために付加された
+
+最初の1行はWindows上での実行時にも問題となることはありませんので
+
+クロスプラットフォームなスクリプトを書くことが出来ます。コマンド
+ ライン用PHPプログラムの単純な例は以下のようなものです。
</para>
<example>
<title>コマンドライン実行用に作成されたスクリプト(script.php)</title>
@@ -187,45 +187,42 @@
</programlisting>
</example>
<para>
- In the script above, we used the special first line to indicate,
- that this file should be run by PHP and should not print out HTTP
- headers. There are two variables you can use while writing command
- line applications with PHP: <varname>$argc</varname> and
- <varname>$argv</varname>. The first is the number of arguments plus
- one (the name of the script running). The second is an array
- containing the arguments, starting with the script name as number
- zero (<varname>$argv[0]</varname>).
- </para>
- <para>
- In the program above we checked if there are less or more than one
- arguments. Also if the argument was <literal>--help</literal>,
- <literal>-help</literal>, <literal>-h</literal> or <literal>-?</literal>,
- we printed out the help message, printng the script name dynamically.
- If we received some other argument we echoed that out.
- </para>
- <para>
- If you would like to run the above script on Unix, you need to
- make it executable, and simply call it as
- <literal>script.php echothis</literal> or
- <literal>script.php -h</literal>. On Windows, you can make a
- batch file for this task:
+
+上記のスクリプトではファイルがPHPによって実行され、またHTTPヘッダを
+
+出力しないことを示す特別な1行目を使用しています。PHPのコマンドライン版
+
+アプリケーションを書くとき、以下の2つの変数を使用することが出来ます:
+ <varname>$argc</varname>と<varname>$argv</varname>です。1番目の変数は
+
+引数の数に1を足した数(実行中のスクリプト名)です。2番目の変数は引数を
+
+格納した配列です。配列はスクリプト名を格納した0(<varname>$argv[0]
+ </varname>)から始まります。
+ </para>
+ <para>
+
+上記のプログラムは、引数の数が1未満か1より多いかどうかをチェック
+ しています。また、もし引数が<literal>--help</literal>, <literal>-help
+ </literal>, <literal>-h</literal>もしくは<literal>--help</literal>
+
+だったら動的にスクリプト名を表示し、ヘルプを出力します。もし他の
+ 引数を受け取ったらそれを表示します。
+ </para>
+ <para>
+
+もし上記のスクリプトをUnixで実行するなら、ファイルに実行権限を与え、
+ 単純に
+ <literal>script.php echothis</literal>もしくは<literal>script.php -h
+
+</literal>というように実行します。Windowsでは、バッチファイルを書く
+ ことで同様のことが行えます:
</para>
<example>
<title>
コマンドライン版PHPスクリプトを実行するバッチファイル(script.bat)
</title>
- <programlisting>
+ <programlisting role="winbat">
@c:\php\php.exe -q script.php %1 %2 %3 %4
</programlisting>
</example>
<para>
- Assuming, you named the above program as
- <filename>script.php</filename>, and you have your
- <filename>php.exe</filename> in
- <filename>c:\php\php.exe</filename> this batch file
- will run it for you with your added options:
- <literal>script.bat echothis</literal> or
- <literal>script.bat -h</literal>.
+
+上記のプログラムを<filename>script.php</filename>という名前にしたとして、
+ また<filename>php.exe</filename>が<filename>c:\php\php.exe</filename>に
+ あるとするとこのバッチファイルは<literal>script.bat
+echothis</literal>
+ もしくは<literal>script.bat
+-h</literal>といったオプションを追加して
+ 実行することが出来ます。
</para>
</appendix>