0

我使用此代码从发布的数据创建 pdf:

header('Content-Type: application/pdf' );
header('Content-Disposition: filename=cert.pdf');


$date = date('F d,Y');
// open our template file
$filename ='PHPCertification.pdf';
$output = file_get_contents($filename);
// replace the place holders in the template with our data
$output = pdf_replace('<<NAME>>',strtoupper($name),$output);
$output = pdf_replace('<<Name>>',$name,$output);
$output = pdf_replace('<<score>>',$score,$output);
$output = pdf_replace('<<mm/dd/yyyy>>',$date,$output);
// send the generated document to the browser
echo $output;

但是当我运行此代码时,我发生此错误: Parse error: syntax error, unexpected '' (T_STRING) in C:\xampp\htdocs\ah\pdf.php on line 40

PHPCertification.pdf 已存在。

但第 40 行是: header('Content-Type: application/pdf' );

我在这里找不到错误

4

0 回答 0