2011-05-18 116 views
6

警告我 “在阵列缺少手柄限定词”:proc_open():缺少手柄预选赛中,C中的数组:\ ... \ updatedots.php上线102PHP proc_open将无法正常工作 - 给

我想在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

什么是102线? – 2011-05-18 17:15:33

+0

'proc_open'是第102行 – Hubro 2011-05-18 18:35:18

+0

然后Stephan说。无论如何,我的评论是试图促使你在未来提供更明确的信息。 – 2011-05-18 23:37:55

回答

8

这不是0 => array("pipe" => "r")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"]);