Re: Passing variables to the script

From: Date: Wed, 08 May 2002 11:09:15 +0000
Subject: Re: Passing variables to the script
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-96566@lists.php.net to get a copy of this message
Well. I need a function which parses string in format "var1=val1&....." and creates varibles from it. Is there such function? -- Regards, Serguei I. Ivantsov ----- Original Message ----- From: "Dan Hardiker" <dhardiker@staff.firstcreative.net> To: <admin@gsc-game.kiev.ua> Cc: <dhardiker@staff.firstcreative.net>; <php-general@lists.php.net> Sent: Wednesday, May 08, 2002 12:52 PM Subject: Re: [PHP] Passing variables to the script > > But how it is implemented in Apache when it (PHP) creates variables > > from URL? > > Umm... You were asking about the command line ... not from a URL. To which > are you refering really? > > 1. Using the CGI binary on the command line to (in effect) shell script in > PHP > 2. Using the Apache module and going to it from the URL > > The variable initalising is totally different in both scenarios (eg: in 2. > you get $_GET, $_POST, etc. global arrays) > > The answers to all your questions lie at > http://www.php.net/en/manual/ > > > > ----- 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 >

« previous php.general (#96566) next »