通过PHP exec传递变量 [英] Passing variable through PHP exec

查看:64
本文介绍了通过PHP exec传递变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用php exec命令执行另一个文件.

I am using the php exec command to execute another file.

我正在使用以下内容:

 exec ('php email.php');

但是我希望通过exec命令将一个名为$ body的变量传递给"email.php"文件.如何通过exec命令传递变量?

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?

推荐答案

传递参数:

exec('php email.php "' . addslashes($body) . '"');

email.php 中获取它:

$body = stripslashes($argv[1]);

这篇关于通过PHP exec传递变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆