From: "Leonard Schneider" <[EMAIL PROTECTED]>

> I use PHP as script to generate HTML pages using the command
> php -q script.php > file.html
> 
> I would like to pass some variables to the PHP script so that it
> generates a different HTML file.
> I tried the -d option but it seems it doesn't work.
> Is there any means of doing this ?
> 
> 
> Leonard Schneider
> 


Easiest way is using environment variables.


<?php
    system("SOME_VAR=blah; php -q script.php > file.html");
?>


Then in script.php you can do:

<?php
    $some_var = getenv("SOME_VAR");
?>


Hope this helps,

Simon Garner


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to