PHP code example of chongyi / actuator
1. Go to this page and download the library: Download chongyi/actuator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chongyi / actuator example snippets
use Dybasedev\Actuator\Actuator;
// 创建执行器实例
$actuator = new Actuator;
// 创建一个进程
$process = $actuator->createProcess('php -i');
// 从管道中读取进程输出的数据
while (!$process->getPipeManager()[1]->eof()) {
print $process->getPipeManager()[1]->read(64);
}
use Dybasedev\Actuator\Actuator;
$actuator = new Actuator;
$printer = $actuator->createProcess('php -i');
$grep = $actuator->createProcess('grep extension');
while (!$process->getPipeManager()[1]->eof()) {
// 从管道中读取进程输出的数据,同时向另一个进程的管道写入数据
$grep->getPipeManager()[0]->write($process->getPipeManager()[1]->read(64));
}
// 关闭 grep 进程的写入管道
$grep->getPipeManager()[0]->close();
// 从 grep 进程管道读取搜索结果
while (!$grep->getPipeManager()[1]->eof()) {
print $grep->getPipeManager()[1]->read(64);
}