未捕获的异常 'Exception' 消息为“FPDF 错误 PHP

Uncaught exception 'Exception' with message 'FPDF error PHP

我正在开发这个网站,该网站有时会导出包含一些约会详细信息的 PDF。它工作正常,但几天前它给我这个错误,到目前为止我不明白为什么。提前致谢!

完全错误:

Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file (output started at /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/pdf.php:2)' in /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/fpdf.php:271 Stack trace: #0 /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/fpdf.php(1052): FPDF->Error('Some data has a...') #1 /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/fpdf.php(1012): FPDF->_checkoutput() #2 /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/pdf.php(123): FPDF->Output('D', 'programare.pdf') #3 {main} thrown in /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/fpdf.php on line 271

fpdf.php

http://pastebin.com/DfaSFCY2

output started at /home/r46122expe/public_html/Domenii/wise-company.com/testprefectura/inf_permise/Rezervari/pdf.php:2

因此您需要检查此脚本而不是 FPDF。您的文件开头可能有空格或 BOM.

如果您使用 UTF-8 编码,请确保您 re-save 您的文件没有 BOM,并确保您打开的 php-tag 位于第一个字节且没有任何前导空格。