PHP 中的 pclose() 函数
phpprogrammingserver side programming更新于 2025/8/9 17:52:17
pclose() 函数用于关闭由 popen() 打开的管道。它返回已运行进程的终止状态。如果发生错误,则返回 -1。
语法
pclose(file_pointer)
参数
file_pointer − 指定管道
返回
pclose() 函数返回已运行进程的终止状态。如果发生错误,则返回 -1。
示例
<?php
// opening a pipe
$file_pointer = popen("/bin/ls", "r");
pclose($file_pointer);
?>
输出
TRUE
让我们看另一个例子。
示例
<?php
// opening a pipe
$file_pointer = popen("/executable/setup.exe", "r");
pclose($file_pointer);
?>
输出
TRUE

