问题
the root of my website is "/var/www/PDFBuilder". I have 2 folders "fpdf17" and "fpdi142" and i've unzipper a file called "fpdf_tpl.php" in the "fpdf17" folder.
This is my code:
error_reporting(E_ALL);
ini_set('display_errors', '1');
define('FPDF_FONTPATH','/var/www/PDFBuilder/fpdf17/');
require('/var/www/PDFBuilder/fpdf17/fpdf.php');
include('/var/www/PDFBuilder/fpdi142/fpdi.php');
When I try to open my website, this is the output I get:
Warning: require_once(fpdf_tpl.php): failed to open stream: No such file or directory in /var/www/PDFBuilder/fpdi142/fpdi.php on line 27 Fatal error: require_once(): Failed opening required 'fpdf_tpl.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/PDFBuilder/fpdi142/fpdi.php on line 27
What am i doing wrong?
回答1:
Found a solution.
you can download the PDF_TPL file (PDF_TPL-1.2.1.zip) from http://www.setasign.de/support/manuals/fpdi/fpdi/
Just extract it and put it in the same folder as the fpdi and you will be fine.
回答2:
Use relative paths, for instance, if your code is within fpdf17, your requires should be:
require('fpdf.php');
require('../fpdi142/fpdi.php');
来源:https://stackoverflow.com/questions/13011400/using-fpdf-and-fpdi