gpt4 book ai didi

PHP proc_open 不起作用 - 给我 "Missing handle qualifier in array"

转载 作者:可可西里 更新时间:2023-11-01 13:21:17 24 4
gpt4 key购买 nike

Warning: proc_open(): Missing handle qualifier in array in C:\...\updatedots.php on line 102

我正在尝试打开记事本并在 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")而是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"]);

关于PHP proc_open 不起作用 - 给我 "Missing handle qualifier in array",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6045884/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com