【问题标题】:php undefined variables error when displaying pdf with mpdf用mpdf显示pdf时php未定义变量错误
【发布时间】:2013-03-29 11:52:14
【问题描述】:

这个 pdf 的东西我已经陷入危机超过 2 天了。它在结果操作页面中没有显示任何错误,仍然没有显示在 pdf 文档中。任何人都可以解决这个问题,也许是一个简单的我猜不是当然。代码如下。 无论如何,提前谢谢大家。

    <?php
      if(isset($_POST['email'])){
       $email = $_POST['email'];
       $fileno = $_POST['fileno'];
       $header = $_POST['header'];
       $day = $_POST['day'];
       $month = $_POST['month'];
       $year = $_POST['year'];
       $stime = $_POST['stime'];
       $venue = $_POST['venue'];
       $meettype = $_POST['meettype'];
       $Itchair = $_POST['Itchair'];
       $mem_pres = $_POST['mem_pres'];
       $invite = $_POST['invite'];

       $head = $_POST['head'];
       $slno = $_POST['slno'];
       $subject = $_POST['subject'];
       $decision = $_POST['decision'];
       $incharge = $_POST['incharge'];
       $date = $_POST['date'];
       $remarks = $_POST['remarks']; 
  }




        include("MPDF54/mpdf.php");

        $mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0);

        $mpdf->SetDisplayMode('fullpage');

        $mpdf->list_indent_first_level = 0;  

        $mpdf->WriteHTML(file_get_contents("http://localhost/Bescom/besc_latest.php?email=$email&fileno=$fileno&header=$header&day=$day&month=$month&year=$year&stime=$stime&venue=$venue&meettype=$meettype&Itchair=$Itchair&mem_pres=$mem_pres&invite=$invite&head=$head&slno=$slno&subject=$subject&decision=$decision&date=$date&incharge=$incharge&remarks=$remarks"));

        $mpdf->Output();


     ?>

【问题讨论】:

  • pdf 仅读取 php 文件的 html 部分,对于 php 部分,未读取表单传递的值,在 pdf 文档中显示“未定义变量”..

标签: include mpdf


【解决方案1】:

在 mpdf.php 顶部添加以下内容

error_reporting(0); 

这将解决问题。

【讨论】:

  • 不,它刚刚阻止了错误,它只显示空白页..没有生成 pdf 文档。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-21
  • 1970-01-01
  • 2011-10-27
  • 2021-01-04
相关资源
最近更新 更多