YIPEE !!!!!! Rev cgi & PHP - new question (shell command)
Alex Tweedly
alex at tweedly.net
Thu Aug 25 18:06:12 EDT 2005
jbv wrote:
>Now I need to find how to pass parameters to the php
>script via the shell...
>
>any help will be apreciated...
>
>
Simply pass the arguments on the command line
shell("php myscript.php alex tweedly")
and in the php script they are available as the array $argv (the number
of command lines arguments is available as $argc
note the first one. $argv[0], will be the script name, subsequent ones
$argv[1], $argv[2], etc. will be any arguments passed.
You will perhaps need to use careful quoting to pass arguments
containing space characters or other chars special to the unix shell.
Depending on how your PHP was installed, there may be a special CLI
(command line) version which provides additional methods to pass
arguments (but they're not supported on Windows, so I don't know
anything about them beyond the mention of the in the PHP manual).
The PHP manual (from www.php.net/docs.php) is pretty good - contains
some samples using these functions to get and manipulate the command
line args
[ btw - use "search" not the "index" of the docs (sound familiar :-) ? ]
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.15/80 - Release Date: 23/08/2005
More information about the use-livecode
mailing list