我有以下问题:我使用此php代码段打开了Chrome无头浏览器:
$chromeBinary = '/usr/bin/google-chrome-stable';
$pdfRenderUrl = $baseUrl . ($json->{'printPath'});
$fileName = 'print_' . $json->{'jpgName'} . '.pdf';
$outputDirectory = '/htdocs/output/' . $fileName;
$command = sprintf(
'%s --headless --virtual-time-budget=8000 --Cache-
Control=no-store --print-to-pdf=%s %s',
escapeshellarg($chromeBinary),
escapeshellarg($outputDirectory),
escapeshellarg($pdfRenderUrl)
);
unlink("/messen/" . $fileName);
exec( $command );
// echo ( file_exists("/data/projects/xxx/htdocs/output/" . $fileName) ? 'TRUE' : 'FALSE');
chmod("/data/projects/xxx/htdocs/output/" . $fileName, 0644);
我认为每个exec
调用都有一个过程。打印pdf后,如何更改此设置并关闭页面?我无法通过composer安装。