Re: Passing variables to the script
| From: | Serguei I. Ivantsov | Date: | Wed, 08 May 2002 09:30:52 +0000 |
| Subject: | Re: Passing variables to the script | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96553@lists.php.net to get a copy of this message | ||
But how it is implemented in Apache when it (PHP) creates variables from
URL?
--
Regards,
Serguei I. Ivantsov
----- Original Message -----
From: "Dan Hardiker" <dhardiker@staff.firstcreative.net>
To: <admin@gsc-game.kiev.ua>
Cc: <php-general@lists.php.net>
Sent: Wednesday, May 08, 2002 12:13 PM
Subject: Re: [PHP] Passing variables to the script
> [plz excuse the rephrasing]
>
> > Is it possible to pass variables to php script from the command line?
> Yes.
>
> > in form of var1=val1&var2=val2
> No.
>
> You have to pass them in as arguments... For Example:
>
> [SCRIPT]
> #!/usr/local/bin/php -q
> <?php
> print_r($argv);
> ?>
>
> [EXECUTION]
> [10:11:28][dhardiker@amnesiac]:~$ chmod +x test.php
> [10:11:31][dhardiker@amnesiac]:~$ ./test.php arg1 arg2 arg3
> Array
> (
> [0] => ./test.php
> [1] => arg1
> [2] => arg2
> [3] => arg3
> )
> [10:11:43][dhardiker@amnesiac]:~$ rm test.php
>
>
> --
> Dan Hardiker [dhardiker@staff.firstcreative.net]
> ADAM Software & Systems Engineer
> First Creative Ltd
>