PHP - proc_open - 环境转发如何工作?
PHP 的 proc_open 函数文档指出,在生成子进程时,您可以传递 null 作为“env”参数的值,以将父脚本的环境转发给子进程。这里有人做过这个吗?如果有的话,您介意详细说明一下吗?
如果用户在父进程中有会话数据,是否会传递给子进程?如果父进程包含各种库、类等...,这些也会传递给子进程吗?
谢谢。
PHP's documentation for the proc_open function states that when spawning a child process, you can pass null as the value for the 'env' parameter to forward the parent script's environment down to the child process. Has anyone here done this, and if so, would you mind elaborating on this?
If a user has session data in the parent process, is that passed to the child? if the parent process has included various libraries, classes, etc..., are those also passed down to the child?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“环境”仅指环境变量集,例如
PATH
。proc_open
函数启动一个新进程并执行新命令,并且调用进程和新进程之间不共享任何数据(但两个进程可以通过管道进行通信)。有关环境变量的一般说明,请参阅 Wikipedia 页面的“环境变量”:http://en。 wikipedia.org/wiki/Environment_variable。
关于环境变量的 PHP 文档: http://php.net/manual/en/reserved .variables.environment.php。
"Environment" means just the set of environment variables, such as
PATH
. Theproc_open
function starts a new process and executes a new command, and no data is shared between the calling process and the new one (but the two processes can communicate through pipes).See the Wikipedia page for "environment variable" for a general explanation of what environment variables are: http://en.wikipedia.org/wiki/Environment_variable.
PHP documentation on environment variables: http://php.net/manual/en/reserved.variables.environment.php.