所以我正在尝试实现PDF导出。我在composer上安装了dompdf,将“'PDF'=> Barryvdh \ DomPDF \ Facade :: class”作为别名,将“ Barryvdh \ DomPDF \ ServiceProvider :: class”置于config / app.php中。在我的路线上,我有以下代码:
\Illuminate\Support\Facades\Route::get('/users/{userId}/details/{forReport}/exportPDF', function($userId) {
$user = UserHelper::getUser($userId);
$internal_devices = UserHelper::getUsersAssignedInternalDevices($userId);
$external_devices = UserHelper::getUsersAssignedExternalDevices($userId);
$licenses = UserHelper::getUsersAssignedLicenses($userId);
$delegation_devices = UserHelper::getUsersDevicesOnDelegation($userId);
$pdf = PDF::loadView(URLHelper::userReportView(),
[
'user' => $user,
'internal_devices' => $internal_devices,
'external_devices' => $external_devices,
'licenses' => $licenses,
'delegation_devices' => $delegation_devices,
]);
return $pdf->download('My.pdf');
})->name('admin.exportPDF');
当我调用此路由时,执行超时,我有300秒。总之,不会生成PDF。我的代码有问题吗?
PS:我做了一个var_damp,一切看起来都很好