Re: run php in commandline
| From: | Jason G. | Date: | Thu, 01 Nov 2001 07:36:11 +0000 |
| Subject: | Re: run php in commandline | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73119@lists.php.net to get a copy of this message | ||
I just did that tonight.
Lookup the predefined variables in the manual.
$argc gives a count of the arguments
$argv is an array of the arguments
Ex:
php -q myscript.php Apple Orange
$argc == 3
$argv[0] == 'php -q myscript.php' or something like that
$argv[1] == 'Apple'
$argv[2] == 'Orange'
-Jason Garber
IonZoft.com
At 03:12 AM 11/1/2001 +0800, JIM wrote:
hi all, i want to know how i can feed a parameter into a php script in commandline? eg. php getdata.php apple orange so, i want to get use of "apple" and "orange"... any help pls! jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net