讨论数量:
@虚妄
<?php
declare(strict_types=1);
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
require __DIR__ . '/vendor/autoload.php';
$process = new Process(['php', '-f', '/path/to/tmp.php']);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
echo $process->getOutput();
可以试试这个包 symfony.com/doc/current/components... ,不过上手难度比较大