I am using the php exec
command to execute another file.
I am using the following:
exec ('php email.php');
But I would wish to pass a variable called $body to "email.php" file through the exec command. How can I pass the variable through exec command?
Pass the argument:
exec('php email.php "' . addslashes($body) . '"');
Get it in email.php:
$body = stripslashes($argv[1]);
Use:
exec ('php email.php firstparameter secondparameter thirdparameter');
You can also refer this : Command Line Manual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With