PHP 文件在脚本完成后关闭浏览器。需要它来显示 "download Complete" 消息
PHP file closes browser once script is complete. Need it to display a "download Complete" message
我有一个 php 脚本引用了另外两个 php 脚本。这三个脚本如下:
主页:
<?php
header("Content-disposition: attachment;
filename=huge_document."
header("Content-type: application/pdf");
$FullName = $_GET["FullName"];
global $FullName;
Include("Code.php");
Include ("GetPDFfromServer.php");
echo ("Download Complete");
?>
Code.php:
<?php
require_once ("fpdf17/fpdf.php");
require_once ('FPDI-1.5.2/fpdi.php');
$pdf =& new FPDI();
$pdf->AddPage();
$pdf->setSourceFile("Secret.pdf");
// import page 1
$tplIdx = $pdf->importPage(1);
//use the imported page and place it at point 0,0; calculate width and height
//automatically and adjust the page size to the size of the imported page
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
// now write some text above the imported page
$pdf->SetFont('Arial', '', '36');
$pdf->SetTextColor(0,0,0);
//set position in pdf document
$pdf->SetXY(195, 240);
//$pdf->Write(0, '|');
$pdf->SetXY(0,240);
$pdf->SetMargins(0,"",0);
//force the browser to download the output
$pdf->Cell(0,0,$FullName,0,0,"C",false,"");
//first parameter defines the line height
$pdf->Output('temp/Secret.pdf', "F");
//return;
?>
GetPDFfromServer.php:
<?php
//header("Content-disposition: attachment; filename=huge_document.pdf");
//header("Content-type: application/pdf");
readfile("temp/NIA_SM_Policy_Digital-CertificateNEW.pdf");
Echo("Download Complete");
//return;
?>
当我加载母版页时(例如:www.example/MasterPage.php?FullName=Mark%20Francis)它成功地完成了所有功能(创建了一个个性化的 .pdf,将其下载到服务器,然后将其下载到浏览器)。但是我想显示一条消息说 "download Complete" 或类似的内容,但浏览器选项卡立即关闭。
如有任何帮助,我们将不胜感激。
谢谢!
我更新的重定向代码:
<!DOCTYPE html>
<html>
<body>
<?php
readfile("temp/Secret.pdf");
?>
<script type="text/javascript">
window.location = "http://www.google.com/"
</script>
</body>
</html>
我有一个 php 脚本引用了另外两个 php 脚本。这三个脚本如下:
主页:
<?php
header("Content-disposition: attachment;
filename=huge_document."
header("Content-type: application/pdf");
$FullName = $_GET["FullName"];
global $FullName;
Include("Code.php");
Include ("GetPDFfromServer.php");
echo ("Download Complete");
?>
Code.php:
<?php
require_once ("fpdf17/fpdf.php");
require_once ('FPDI-1.5.2/fpdi.php');
$pdf =& new FPDI();
$pdf->AddPage();
$pdf->setSourceFile("Secret.pdf");
// import page 1
$tplIdx = $pdf->importPage(1);
//use the imported page and place it at point 0,0; calculate width and height
//automatically and adjust the page size to the size of the imported page
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
// now write some text above the imported page
$pdf->SetFont('Arial', '', '36');
$pdf->SetTextColor(0,0,0);
//set position in pdf document
$pdf->SetXY(195, 240);
//$pdf->Write(0, '|');
$pdf->SetXY(0,240);
$pdf->SetMargins(0,"",0);
//force the browser to download the output
$pdf->Cell(0,0,$FullName,0,0,"C",false,"");
//first parameter defines the line height
$pdf->Output('temp/Secret.pdf', "F");
//return;
?>
GetPDFfromServer.php:
<?php
//header("Content-disposition: attachment; filename=huge_document.pdf");
//header("Content-type: application/pdf");
readfile("temp/NIA_SM_Policy_Digital-CertificateNEW.pdf");
Echo("Download Complete");
//return;
?>
当我加载母版页时(例如:www.example/MasterPage.php?FullName=Mark%20Francis)它成功地完成了所有功能(创建了一个个性化的 .pdf,将其下载到服务器,然后将其下载到浏览器)。但是我想显示一条消息说 "download Complete" 或类似的内容,但浏览器选项卡立即关闭。
如有任何帮助,我们将不胜感激。
谢谢!
我更新的重定向代码:
<!DOCTYPE html>
<html>
<body>
<?php
readfile("temp/Secret.pdf");
?>
<script type="text/javascript">
window.location = "http://www.google.com/"
</script>
</body>
</html>