HTML到PDF,结果列为空

时间:2015-04-29 16:36:14

标签: php pdf dompdf

我正在使用以下代码来创建pdf。

第一个 memberinfo.php 页面包含来自mysql数据库的成员名称,地址,城市等的表。此文件位于www.example.com/admin文件夹

第二个是用于创建PDF的 member_pdf.php 。它位于www.example.com/admin/do-pdf/dompdf/文件夹

memberinfo.php 中的代码:

<?
 include("../include/function.php"); // to connect database
// Create an object for an class
$bsq=new bsq();
//use class function to connect the database
$bsq->connect_db();

//=================================================================================
$reg_id=$_GET["reg_id"];

$where="reg_id='".$_GET["reg_id"]."'";
$web_dataRS=$bsq->webdreamselect('tablename',$where,'','','','');
  $member_data=mysql_fetch_array($web_dataRS);
?>

 //This Table Is Shown When I click On View Details Link On Member's List Page...
 <table>
  <tr>
   <td> Name </td><td><?=$member_data['name'];?></td>
   <td> Address </td><td><?=$member_data['address'];?></td>
   ..
   ..
   ..
  </tr>
 </table>

代码 member_pdf.php

<?php

    require_once("dompdf_config.inc.php");


     ob_start();
    //be sure this file exists, and works outside of web context etc.)
    require("http://example.com/admin/memberinfo.php");
    $dompdf = new DOMPDF();
    $dompdf->load_html(ob_get_clean());
    $dompdf->render();
    $dompdf->stream("file.pdf");
?>    

现在问题是,PDF已创建但是包含$ member_data ['name'],$ member_data ['address']等的表格TD是空的.....

见Image =

enter image description here

0 个答案:

没有答案