pclose

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

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

說明

pclose(resource $handle): int

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

參數(shù)

handle

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

返回值

返回運行的進程的終止狀態(tài)。發(fā)生錯誤時會返回 -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.

參見

  • popen() - 打開進程文件指針