不能使用php,mysql将pdf文件作为输出

时间:2015-12-24 09:34:45

标签: php mysql fpdf

我想使用fpdf生成PDF文件

但我得到的错误如下: fpdf错误:某些数据已经输出无法发送pdf文件

<?php
    $indexcontent = mysql_real_escape_string($_GET['index']);
     $detailview = mysql_query("SELECT * FROM `searchengine` WHERE `indexcontent` = '$indexcontent'") or die(mysql_error());
    if($result = mysql_fetch_assoc($detailview))
    {
    $filepdf = $result['maincontent'];
    require('fpdf.php');
    $pdf = new FPDF();
    $pdf->AddPage();
    $pdf->SetFont('Arial','B',16);
    $pdf->Cell(40,10,'$filepdf');
    $pdf->Output();
    }
?>

2 个答案:

答案 0 :(得分:0)

不要在单引号之间放置变量,尝试在双引号之间放置。

答案 1 :(得分:0)

试试这个:

ScrollView
相关问题