Re: How to give parameters to a console php-script?
| From: | David Yee | Date: | Fri, 03 Jan 2003 00:59:52 +0000 |
| Subject: | Re: How to give parameters to a console php-script? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130017@lists.php.net to get a copy of this message | ||
Martin- the command line switches are stored in the $_SERVER['argv'] array.
E.g.
php -q myscript.php4 1000
The value of $_SERVER['argv'][1] in the myscript.php4 script would be 1000.
David
----- Original Message -----
From: "Martin Thoma" <martin@radiok2r.de>
To: <php-general@lists.php.net>
Sent: Monday, December 02, 2002 5:40 AM
Subject: [PHP] How to give parameters to a console php-script?
> Hello!
>
> I start a console app with
>
> php myscript.php4 (just prints "ok").
>
> How can I give parameters to it? I tried:
> php myscript.php4 myparameter
> php myscript.php4?myparameter
> php myscript.php4?param=myparameter
>
> But always php just returns without doing nothing (not even giving an
> error or printing "Ok"!) I'm using PHP 4.2.3. on Windows2000).
>
> Martin
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>