lshepstone / php-proc
PHP proc_* 库
dev-master
2013-01-25 13:21 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-14 14:39:55 UTC
README
PHP proc_* 函数的基本封装(阻塞、单线程、有限的 Windows 支持)。
use \PhpProc\Process; $process = new Process(); $result = $process ->setCommand("/usr/bin/php -r \"echo getenv('USER');\""); ->setWorkingDirectory(__DIR__); ->setEnvironmentVars(array( 'PATH' => getenv('PATH'), 'SHELL' => getenv('SHELL'), 'USER' => 'developer')) ->execute(); echo 'Status: ' . $result->getStatus() . PHP_EOL; if ($result->hasErrors()) { echo 'Errors: ' . $result->getStdErrContents(); } else { echo 'Output: ' . $result->getStdOutContents(); }
Status: 0
Output: developer