Re: command line arguments
| From: | Ray Hunter | Date: | Wed, 22 Oct 2003 18:33:55 +0000 |
| Subject: | Re: command line arguments | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167144@lists.php.net to get a copy of this message | ||
> I have a php script that I want to run from a command line:
>
> % /usr/local/bin/php script.php 47264
>
> 47264 is the argument, however, I can't figure out how to access it inside
> the script. I thought it was the $ARG array or $ARGV, but I am mistaken...
> can only refresh me? searching did no good.
$argv is an array that will give you the values and $argc will give you
the total number (count) of arguments.
Also, make sure that you have your php.ini file set up to populate those
variables.
Check this tutorial out: http://www.phpb.com/columns/ray/cli/
To get you started.
--
Ray