mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Correcting CGI/CLI problems in script and windows examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@82465 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
7685986d45
commit
c34d7c1d9a
1 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<chapter id="features.commandline">
|
||||
<title>Using PHP from the command line</title>
|
||||
<!-- NEW DOCUMENTATION STARTS -->
|
||||
|
@ -822,7 +822,7 @@ Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]}
|
|||
<title>Script intended to be run from command line (script.php)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
#!/usr/bin/php -q
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
|
||||
|
@ -847,13 +847,13 @@ This is a command line PHP script with one option.
|
|||
</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>).
|
||||
that this file should be run by PHP. We work with a CLI version
|
||||
here, so there will be no HTTP header printouts. 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
|
||||
|
@ -872,7 +872,7 @@ This is a command line PHP script with one option.
|
|||
<example>
|
||||
<title>Batch file to run a command line PHP script (script.bat)</title>
|
||||
<programlisting role="winbat">
|
||||
@c:\php\php.exe -q script.php %1 %2 %3 %4
|
||||
@c:\php\php.exe script.php %1 %2 %3 %4
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue