簡體   English   中英

帶include的mPdf輸出不起作用

[英]mPdf Output with include not working

我正在使用mdpf將php文件輸出為pdf文件。 問題是我有一個include,它根本不輸出文件。 當我取出include時,它起作用了,但是當我放回include時,它直接進入瀏覽器。

這是代碼:

  <?php
      session_start();
      require('mpdf.php');
      $mpdf=new mPDF();

      ob_start();

      $id   =  $_POST['tempId'];
      $_SESSION = $id

      include('report-gen.php');

      $html = ob_get_contents();

      ob_end_clean();

      $mpdf = new mPDF();
      $mpdf->WriteHTML($html);
      $mpdf->debug = true;
      $fileName = $id.'.pdf';
      //$mpdf->SetProtection(array(), 'user', 'password'); uncomment to      protect your pdf page with password.
      $mpdf->Output($fileName,'D');
      exit;
       ?>

謝謝....

解決了..導致問題的是包含文件。 現在正在工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM