parameters and commandline

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

i want to start a php programm from commandline and pass some parameters to
the programm. but the programm did not recognize the parameters.

the commandline ist: php liste.php para1=one para2=two

the source (list.php)

echo $_request[para1];
echo $_request[para2];

why does this not work?

Re: parameters and commandline

Alexander Gausa wrote:
Quoted text here. Click to load it
parameters to

When using PHP from the command line you need to use the array $argv.
The $_REQUEST superglobal is only available when running via a web

For example:
cmdline.php contains:
print_r ($argv);

When run from the command line:
php -q cmdline.php para1=one para2=two

The results are:
    [0] => cmdline.php
    [1] => para1=one
    [2] => para2=two


Re: parameters and commandline

Thanks, it is working!

Ken Robinson wrote:

Quoted text here. Click to load it

Site Timeline