警告:proc_open():第 102 行 C:\...\updatedots.php 中的数组中缺少句柄限定符
我正在尝试打开记事本并在 2 秒后将其关闭。这是我的代码:
$descriptorspec = array(
0 => array("pipe" => "r"),
1 => array("pipe" => "w"),
2 => array("file" => "logs/errors.txt")
);
// Create child and start process
$child = array("process" => null, "pipes" => array());
$child["process"] = proc_open("notepad.exe > nul 2>&1", $descriptorspec, $child["pipes"]);
知道这个错误意味着什么以及导致它的原因吗?
它不是0 => array("pipe" => "r")
but 0 => array("pipe", "r")
^^
此外,在给出文件名时,您需要指定要使用的模式。这适用于我的机器:
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "logs/errors.txt", "a") );
// Create child and start process
$child = array("process" => null, "pipes" => null);
$child["process"] = proc_open("notepad.exe > nul 2>&1", $descriptorspec, $child["pipes"]);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)