pclose

(PHP 4, PHP 5, PHP 7, PHP 8)

pclose關(guān)閉進(jìn)程文件指針

說(shuō)明

pclose(resource $handle): int

關(guān)閉用 popen() 打開(kāi)的指向管道的文件指針。

參數(shù)

handle

文件指針必須有效,且必須是成功調(diào)用 popen() 所返回的。

返回值

返回運(yùn)行的進(jìn)程的終止?fàn)顟B(tài)。發(fā)生錯(cuò)誤時(shí)會(huì)返回 -1

范例

示例 #1 pclose() 例子

<?php
$handle 
popen('/bin/ls''r');
pclose($handle);
?>

注釋

注意: Unix Only:

proc_close() is internally implemented using the waitpid(3) system call. To obtain the real exit status code the pcntl_wexitstatus() function should be used.

參見(jiàn)

  • popen() - 打開(kāi)進(jìn)程文件指針