【问题标题】:mPdf Output with include not working包含不工作的 mPdf 输出
【发布时间】:2015-03-25 19:19:32
【问题描述】:

我正在使用 mdpf 将 php 文件输出为 pdf 文件。问题是我有一个包含它根本不输出文件。当我取出包含它时,它可以工作,但是,当我把它放回去时,它只是直接进入浏览器。

代码如下:

  <?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;
       ?>

谢谢……

【问题讨论】:

    标签: php mpdf


    【解决方案1】:

    解决了.. 是包含文件导致了问题。它现在正在工作。

    【讨论】:

      猜你喜欢
      • 2019-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-08
      • 1970-01-01
      • 1970-01-01
      • 2020-11-05
      • 2015-12-28
      相关资源
      最近更新 更多