在php中创建pdf文件时出错

时间:2013-05-11 06:58:54

标签: php string pdf-generation

我使用此代码从发布的数据创建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;

但是当我运行此代码时,我发生此错误:      解析错误:语法错误,第40行的C:\ xampp \ htdocs \ ah \ pdf.php中的意外''(T_STRING)

PHPCertification.pdf已存在。

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

我在这里找不到错误

0 个答案:

没有答案