file_put_contents(xxx.pdf):无法打开流:没有这样的文件或目录”

时间:2018-11-05 07:21:16

标签: laravel dompdf

我正在使用barryvdh/laravel-dompdf创建我的pdf文档。我已经在控制器中创建了一个函数来创建pfd。但是现在我要保存pdf。

 $myData = array('data' => $data);

 if (!empty($data)){

   // Send data to the view using loadView function of PDF facade
   $pdf = PDF::loadView('pdf.invoice', $myData);

   // If you want to store the generated pdf to the server then you can use the 
   store function

   // Finally, you can download the file using download functio
   $pdf->save(storage_path('invoices\INV'.$year.Auth::user()->lab_id.'.pdf'));

   return $pdf->download('invoice.pdf');
 }

但是现在我收到错误消息

  

file_put_contents(C:\laragon\www\WebPTS\storage\invoices\INV201846.pdf): failed to open stream: No such file or directory

请协助。

1 个答案:

答案 0 :(得分:0)