3

我的语法有问题,页面和表格没有显示。我不确定。谁能帮我?肿瘤坏死因子

即使在stackoverflow中,我也一直是这个脚本。我已经测试了 tcpdf 示例并且它们正在工作。所以我做了一个示例项目,将这个项目放在一个页面中。当我尝试运行它时。什么都没有显示。

请帮忙。

<?php

include('connect.php');
    //require_once('../tcpdf/config/lang/eng.php');
    require_once('../tcpdf/tcpdf.php');
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8',       false);

    // set default font subsetting mode
    $pdf->setFontSubsetting(true);


    $pdf->SetFont('dejavusans', '', 14, '', true);

    // Add a page

    $pdf->AddPage("L");

    $query=mysql_query("SELECT fname,mname,lname FROM emp_tbl");


    $tbl_header = '<table style="width: 638px;" cellspacing="0">';
    $tbl_footer = '</table>';
    $tbl = '';

    $tbl_header = '<table id="gallerytab" width="600" cellspacing="2" cellpadding="1"   border="0">
    <tr>
    <th><font face="Arial, Helvetica, sans-serif">Employee Name</font></th>

    </tr>';

    $tbl_footer = '</table>';
    $tbl = '';

    while($row = mysql_fetch_array($query))
    {
$tbl .= '
<tr>
    <td>'.$row['fname'].''.$row['mname'].''.$row['lname'].'</td>
</tr>
        ';
   }
     // output the HTML content
    $pdf->writeHTML($tbl_header . $tbl . $tbl_footer, true, false, false, false, '');

    ?>
4

1 回答 1

2

你的 php 文件还没有完成。您希望如何输出 PDF(例如文件、浏览器内联等)?无论哪种方式,都可以添加以下内容:

return $pdf->Output('filename.pdf', 'I');
  • 一:内联
  • D:在浏览器中下载
  • F:保存文件到服务器
  • S:输出为 php 字符串

那应该这样做。

于 2013-06-09T17:40:05.167 回答