cvs: phpdoc /ja/appendices commandline.xml
| From: | Rui Hirokawa | Date: | Sun, 28 Oct 2001 23:15:30 +0000 |
| Subject: | cvs: phpdoc /ja/appendices commandline.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969338283@lists.php.net to get a copy of this message | ||
hirokawa Sun Oct 28 18:15:30 2001 EDT
Added files:
/phpdoc/ja/appendices commandline.xml
Log:
added commandline.xml in japanese manual.
Index: phpdoc/ja/appendices/commandline.xml +++ phpdoc/ja/appendices/commandline.xml <?xml encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- TODO: The command line options not in the list, but in the -h output below: -f, -e, -z, -l It would be best to document these, and collect more info about -c and -d! --> <appendix id="commandline"> <title>ã³ãã³ãã©ã¤ã³ããPHPã使ã</title> <para> PHPã³ãã³ãã©ã¤ã³çã¯ããããã°æãPHPã®è¨å®ããã¹ãããããããªå ´ åã«ã¯ä¾¿å©ã§ããã°ããã§ãªããWebã¹ã¯ãªãã使以å¤ã®ç¨éã«PHPã使 ç¨ãããå ´åã«ã¯ã便å©ãªé¸æè¢ã§ãã </para> <para> PHPå®è¡ãã¡ã¤ã«ã®åºåãå¤é¨ãã¡ã¤ã«ã«>æåã§å¸¸ã«ãªãã¤ã¬ã¯ãã§ãã ãã®ããã<literal>php -q test.php > test.html</literal>ã¯ã <filename>test.php</filename>ã®åºåãHTTPããããä»å ããã«åãã㣠ã¬ã¯ããªã®<filename>test.html</filename>ãã¡ã¤ã«ã«åºåãã¾ãã </para> <para> ã³ãã³ãã©ã¤ã³çã¯ãPHPå®è¡ãã¡ã¤ã«ãããå ´åã«ã®ã¿ä½¿ç¨å¯è½ã§ãããµã¼ ãã¢ã¸ã¥ã¼ã«çãæ§ç¯ããCGIçã使ç¨ãããã·ã³ã§å©ç¨å¯è½ã§ãªãå ´åã 使ç¨ãããã¨ã¯ã§ãã¾ãããWindowsã¦ã¼ã¶ã®å ´åãPHPå®è¡ãã¡ã¤ã«ã¨ãµã¼ ãã¢ã¸ã¥ã¼ã«ãå ±ã«ãã¤ããªããã±ã¼ã¸ã«å ¥ã£ã¦ãã¾ããå®è¡ãã¡ã¤ã«ã® ååã¯ã<filename>php.exe</filename>ã§ãã </para> <para> 以ä¸ã«PHP 4.0.6ã«é¢ããã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã示ãã¾ãã <literal>-h</literal> ãªãã·ã§ã³ã使ç¨ãããã¨ã«ãããå®éã®ãªã¹ã ã¨ãã®ç°¡åãªèª¬æãå¾ããã¨ãå¯è½ã§ãã<literal>php -h</literal> ã® åºåã¯ã以ä¸ã®ããã«ãªãã¾ãã <programlisting> <![CDATA[ Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]} -q Quiet-mode. Suppress HTTP Header output. -s Display colour syntax highlighted source. -f <file> Parse <file>. Implies `-q' -v Version number -C Do not chdir to the script's directory -c <path> Look for php.ini file in this directory -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -z <file> Load Zend extension <file>. -l Syntax check only (lint) -m Show compiled in modules -i PHP information -h This help ]]> </programlisting> </para> <para> 以ä¸ã«æãéè¦ãªã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã®ããã¤ãã«ã¤ãã¦è©³ç´°ãªè§£ 説ãè¡ãã¾ãã </para> <para> <table> <title>ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³</title> <tgroup cols="2"> <thead> <row> <entry>ãªãã·ã§ã³</entry> <entry>説æ</entry> </row> </thead> <tbody> <row> <entry>-q</entry> <entry> HTTPãããåºåãæå¶ãã¾ããé常ãPHPã¯ã³ã¼ã«ããããã°ã©ã (ã ãªãã¡Webãµã¼ã)ããã©ã¦ã¶ã«åºåããããã«HTTPããããåºåãã¾ ããã³ãã³ãã©ã¤ã³ã¢ããªã±ã¼ã·ã§ã³ã使ããå ´åã«ã¯ããããã® ãããã¯æå³ãããã¾ããã </entry> </row> <row> <entry>-s</entry> <entry> ãã¡ã¤ã«åã§æå®ããããã¡ã¤ã«ãã«ã©ã¼ãã¤ã©ã¤ã表示ã«ãã¦åºå ãã¾ããããã¯ãPHPã¹ã¯ãªããã§ã½ã¼ã¹ã³ã¼ãã <function>highlight_file</function>ã«ããåºåããã®ã¨åãã§ãã </entry> </row> <row> <entry>-v</entry> <entry> ãã®ãªãã·ã§ã³ãä»ãã¦PHPãã³ã¼ã«ããã¨ããã¼ã¸ã§ã³çªå·ãã㪠ãã¡ã4.0.6ãç¥ããã¨ãã§ãã¾ãã </entry> </row> <row> <entry>-C</entry> <entry> é常ãPHPã¯ä½æ¥ãã£ã¬ã¯ããªãã¹ã¯ãªããããããã£ã¬ã¯ããªã«å¤ æ´ãã¾ããããã«ãããä¾ãã°ãã¡ã¤ã«åãæå®ããã ãã§åãã㣠ã¬ã¯ããªã«ãããã¡ã¤ã«ããªã¼ãã³ãããã¨ãå¯è½ã¨ãªãã¾ãã ãã®ãã£ã¬ã¯ããªå¤æ´ãç¡å¹ã«ãããå ´åã¯ãã®ãªãã·ã§ã³ã使ç¨ã ã¦ä¸ããã </entry> </row> <row> <entry>-c</entry> <entry> ãã®ãªãã·ã§ã³ã使ç¨ããã¨ãå¥ã®<filename>php.ini</filename> ã®ãã¹ãæå®ãããã¨ãå¯è½ã§ãããã®å ´åãPHPã¯ãããã©ã«ãã® ãã¹ã®ä»£ããã«æå®ãããã¹ã§è¨å®ãã¡ã¤ã«ãæ¢ãã¾ãã </entry> </row> <row> <entry>-d</entry> <entry> ãã®ãªãã·ã§ã³ãä»ãããã¨ã«ãããã¹ã¯ãªããå®è¡æã«ãåã ã® <filename>php.ini</filename>è¨å®ãè¨å®ãããã¨ãå¯è½ã§ãã </entry> </row> <row> <entry>-m</entry> <entry> ãã®ãªãã·ã§ã³ã«ãããçµã¿è¾¼ã¾ãã(ããã¦ãã¼ãããã)PHPã¢ã¸ã¥ã¼ ã«ããã³Zendã¢ã¸ã¥ã¼ã«ãPHPããã³Zendã®ãã¼ã¸ã§ã³çªå·ãZendã® è使¨©ã®ç°¡ç¥çãåºåãã¾ãã </entry> </row> <row> <entry>-i</entry> <entry> ãã®ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã¯ã<function>phpinfo</function>ã ã³ã¼ã«ããçµæãåºåãã¾ããPHPãæ£ããåä½ããªãå ´åã <literal>php -i</literal>ãå®è¡ããæ å ±ãã¼ãã«ã®åã¾ãã¯ä¸ã« åºåããã¦ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã確èªãã¦ä¸ããã </entry> </row> <row> <entry>-h</entry> <entry> ãã®ãªãã·ã§ã³ãä»ããã¨ãå®éã®ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³åã³ã ã®ç°¡åãªèª¬æãå¾ããã¨ãã§ãã¾ãã </entry> </row> </tbody> </tgroup> </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. </para> <example> <title>ã³ãã³ãã©ã¤ã³å®è¡ç¨ã«ä½æãããã¹ã¯ãªãã(script.php)</title> <programlisting role="php"> <![CDATA[ #!/usr/bin/php -q <?php if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) { ?> ããã¯ããªãã·ã§ã³ãï¼ã¤ããã³ãã³ãã©ã¤ã³çã®PHPã¹ã¯ãªããã§ãã ä½¿ç¨æ³: <?php echo $argv[0]; ?> <option> <option> ã«åºåãããä½ããã®åèªãæå®ã§ãã¾ãã --help, -help, -h, -? ãªãã·ã§ã³ãæå®ããã¨ãã®ãã«ãã表示ããã¾ãã <?php } else { echo $argv[1]; } ?> ]]> </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: </para> <example> <title> ã³ãã³ãã©ã¤ã³çPHPã¹ã¯ãªãããå®è¡ããããããã¡ã¤ã«(script.bat) </title> <programlisting> @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>. </para> </appendix> <!-- 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 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 -->
Index: phpdoc/ja/appendices/commandline.xml +++ phpdoc/ja/appendices/commandline.xml <?xml encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- TODO: The command line options not in the list, but in the -h output below: -f, -e, -z, -l It would be best to document these, and collect more info about -c and -d! --> <appendix id="commandline"> <title>ã³ãã³ãã©ã¤ã³ããPHPã使ã</title> <para> PHPã³ãã³ãã©ã¤ã³çã¯ããããã°æãPHPã®è¨å®ããã¹ãããããããªå ´ åã«ã¯ä¾¿å©ã§ããã°ããã§ãªããWebã¹ã¯ãªãã使以å¤ã®ç¨éã«PHPã使 ç¨ãããå ´åã«ã¯ã便å©ãªé¸æè¢ã§ãã </para> <para> PHPå®è¡ãã¡ã¤ã«ã®åºåãå¤é¨ãã¡ã¤ã«ã«>æåã§å¸¸ã«ãªãã¤ã¬ã¯ãã§ãã ãã®ããã<literal>php -q test.php > test.html</literal>ã¯ã <filename>test.php</filename>ã®åºåãHTTPããããä»å ããã«åãã㣠ã¬ã¯ããªã®<filename>test.html</filename>ãã¡ã¤ã«ã«åºåãã¾ãã </para> <para> ã³ãã³ãã©ã¤ã³çã¯ãPHPå®è¡ãã¡ã¤ã«ãããå ´åã«ã®ã¿ä½¿ç¨å¯è½ã§ãããµã¼ ãã¢ã¸ã¥ã¼ã«çãæ§ç¯ããCGIçã使ç¨ãããã·ã³ã§å©ç¨å¯è½ã§ãªãå ´åã 使ç¨ãããã¨ã¯ã§ãã¾ãããWindowsã¦ã¼ã¶ã®å ´åãPHPå®è¡ãã¡ã¤ã«ã¨ãµã¼ ãã¢ã¸ã¥ã¼ã«ãå ±ã«ãã¤ããªããã±ã¼ã¸ã«å ¥ã£ã¦ãã¾ããå®è¡ãã¡ã¤ã«ã® ååã¯ã<filename>php.exe</filename>ã§ãã </para> <para> 以ä¸ã«PHP 4.0.6ã«é¢ããã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã示ãã¾ãã <literal>-h</literal> ãªãã·ã§ã³ã使ç¨ãããã¨ã«ãããå®éã®ãªã¹ã ã¨ãã®ç°¡åãªèª¬æãå¾ããã¨ãå¯è½ã§ãã<literal>php -h</literal> ã® åºåã¯ã以ä¸ã®ããã«ãªãã¾ãã <programlisting> <![CDATA[ Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]} -q Quiet-mode. Suppress HTTP Header output. -s Display colour syntax highlighted source. -f <file> Parse <file>. Implies `-q' -v Version number -C Do not chdir to the script's directory -c <path> Look for php.ini file in this directory -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -z <file> Load Zend extension <file>. -l Syntax check only (lint) -m Show compiled in modules -i PHP information -h This help ]]> </programlisting> </para> <para> 以ä¸ã«æãéè¦ãªã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã®ããã¤ãã«ã¤ãã¦è©³ç´°ãªè§£ 説ãè¡ãã¾ãã </para> <para> <table> <title>ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³</title> <tgroup cols="2"> <thead> <row> <entry>ãªãã·ã§ã³</entry> <entry>説æ</entry> </row> </thead> <tbody> <row> <entry>-q</entry> <entry> HTTPãããåºåãæå¶ãã¾ããé常ãPHPã¯ã³ã¼ã«ããããã°ã©ã (ã ãªãã¡Webãµã¼ã)ããã©ã¦ã¶ã«åºåããããã«HTTPããããåºåãã¾ ããã³ãã³ãã©ã¤ã³ã¢ããªã±ã¼ã·ã§ã³ã使ããå ´åã«ã¯ããããã® ãããã¯æå³ãããã¾ããã </entry> </row> <row> <entry>-s</entry> <entry> ãã¡ã¤ã«åã§æå®ããããã¡ã¤ã«ãã«ã©ã¼ãã¤ã©ã¤ã表示ã«ãã¦åºå ãã¾ããããã¯ãPHPã¹ã¯ãªããã§ã½ã¼ã¹ã³ã¼ãã <function>highlight_file</function>ã«ããåºåããã®ã¨åãã§ãã </entry> </row> <row> <entry>-v</entry> <entry> ãã®ãªãã·ã§ã³ãä»ãã¦PHPãã³ã¼ã«ããã¨ããã¼ã¸ã§ã³çªå·ãã㪠ãã¡ã4.0.6ãç¥ããã¨ãã§ãã¾ãã </entry> </row> <row> <entry>-C</entry> <entry> é常ãPHPã¯ä½æ¥ãã£ã¬ã¯ããªãã¹ã¯ãªããããããã£ã¬ã¯ããªã«å¤ æ´ãã¾ããããã«ãããä¾ãã°ãã¡ã¤ã«åãæå®ããã ãã§åãã㣠ã¬ã¯ããªã«ãããã¡ã¤ã«ããªã¼ãã³ãããã¨ãå¯è½ã¨ãªãã¾ãã ãã®ãã£ã¬ã¯ããªå¤æ´ãç¡å¹ã«ãããå ´åã¯ãã®ãªãã·ã§ã³ã使ç¨ã ã¦ä¸ããã </entry> </row> <row> <entry>-c</entry> <entry> ãã®ãªãã·ã§ã³ã使ç¨ããã¨ãå¥ã®<filename>php.ini</filename> ã®ãã¹ãæå®ãããã¨ãå¯è½ã§ãããã®å ´åãPHPã¯ãããã©ã«ãã® ãã¹ã®ä»£ããã«æå®ãããã¹ã§è¨å®ãã¡ã¤ã«ãæ¢ãã¾ãã </entry> </row> <row> <entry>-d</entry> <entry> ãã®ãªãã·ã§ã³ãä»ãããã¨ã«ãããã¹ã¯ãªããå®è¡æã«ãåã ã® <filename>php.ini</filename>è¨å®ãè¨å®ãããã¨ãå¯è½ã§ãã </entry> </row> <row> <entry>-m</entry> <entry> ãã®ãªãã·ã§ã³ã«ãããçµã¿è¾¼ã¾ãã(ããã¦ãã¼ãããã)PHPã¢ã¸ã¥ã¼ ã«ããã³Zendã¢ã¸ã¥ã¼ã«ãPHPããã³Zendã®ãã¼ã¸ã§ã³çªå·ãZendã® è使¨©ã®ç°¡ç¥çãåºåãã¾ãã </entry> </row> <row> <entry>-i</entry> <entry> ãã®ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã¯ã<function>phpinfo</function>ã ã³ã¼ã«ããçµæãåºåãã¾ããPHPãæ£ããåä½ããªãå ´åã <literal>php -i</literal>ãå®è¡ããæ å ±ãã¼ãã«ã®åã¾ãã¯ä¸ã« åºåããã¦ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã確èªãã¦ä¸ããã </entry> </row> <row> <entry>-h</entry> <entry> ãã®ãªãã·ã§ã³ãä»ããã¨ãå®éã®ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³åã³ã ã®ç°¡åãªèª¬æãå¾ããã¨ãã§ãã¾ãã </entry> </row> </tbody> </tgroup> </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. </para> <example> <title>ã³ãã³ãã©ã¤ã³å®è¡ç¨ã«ä½æãããã¹ã¯ãªãã(script.php)</title> <programlisting role="php"> <![CDATA[ #!/usr/bin/php -q <?php if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) { ?> ããã¯ããªãã·ã§ã³ãï¼ã¤ããã³ãã³ãã©ã¤ã³çã®PHPã¹ã¯ãªããã§ãã ä½¿ç¨æ³: <?php echo $argv[0]; ?> <option> <option> ã«åºåãããä½ããã®åèªãæå®ã§ãã¾ãã --help, -help, -h, -? ãªãã·ã§ã³ãæå®ããã¨ãã®ãã«ãã表示ããã¾ãã <?php } else { echo $argv[1]; } ?> ]]> </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: </para> <example> <title> ã³ãã³ãã©ã¤ã³çPHPã¹ã¯ãªãããå®è¡ããããããã¡ã¤ã«(script.bat) </title> <programlisting> @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>. </para> </appendix> <!-- 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 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 -->