如何在PHPIPC::Open3中像PERL一样做



在使用PHP的本地linux框中,我需要执行一些任务,例如进程启动,过一段时间后使用processID来终止。

在Perl、IPC::Open3是实现这一点的令人满意的方式的地方,我怎么能用PHP做到这一点呢?以前有人用PHP做过这个吗?

PERL:

use IPC::Open3;
my @cmd = ('wget','-O','-','http://10.10.1.72/index.php');#any website will do here
my ($wget_pid,$wget_in,$wget_out,$wget_err);
if (!($wget_pid = open3($wget_in,$wget_out,$wget_err,@cmd))){
    print STDERR "failed to run open3n";
    exit(1)
}
close($wget_in);

感谢

使用proc_open()并确保您已启用pcntl

最新更新