pclose

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

pcloseCloses process file pointer

Опис

pclose(resource $handle): int

Closes a file pointer to a pipe opened by popen().

Параметри

handle

The file pointer must be valid, and must have been returned by a successful call to popen().

Значення, що повертаються

Returns the termination status of the process that was run. In case of an error then -1 is returned.

Зауваження:

Якщо PHP скомпільовано з --enable-sigchild, значення, що повертається цією функцією, не визначене.

Приклади

Приклад #1 pclose() example

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

Примітки

Зауваження: Unix Only:

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

Прогляньте також

  • popen() - Opens process file pointer