下面给出了一个php脚本(report.php),它在单击按钮时生成pdf报告!很遗憾pdf在同一页面上打开我想在新页面上打开pdf!我怎么能做到这一点?
<?php
require_once("includes/db.php"); // provides db connection
require("fpdf/fpdf.php");
}
$sql="SELECT count(Email) as Number, Date from reportorder";
$result=mysqli_query($db,$sql);
$pdf=new PDF();
$pdf->AddPage();
$pdf->AliasNbPages();
$pdf->SetFont('Arial','B',12);
$pdf->Cell(90,10,'Date',1,0,'C',0);
$pdf->Cell(90,10,'Number of orders',1,1,'C',0);
while($row=mysqli_fetch_array($result))
{
// cell with left and right borders
$pdf->Cell(90,10,$row['Date'],1,0,'C',0); // 1,0
$pdf->Cell(90,10,$row['Number'] ,1,1,'C',0);
}
$pdf->output();
?>
按钮部分位于iframe内加载的页面
<a href='report.php'>
<input class='button1' type='button' value='View report' >
</a>
答案 0 :(得分:1)
<a href='report.php' target="_blank">
需要添加此目标属性