问题
i have found some pdf file geneartion program in php. When i reun it i get the following error
Warning: require(/include/fpdf153/fpdf.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\aks\mikepdf.php on line 57
Fatal error: require() [function.require]: Failed opening required '/include/fpdf153/fpdf.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\aks\mikepdf.php on line 57
I think the fpdf.php is missing. I have searched on their site but i could not find the english version.
can anyone provide me full link of english version?
回答1:
Currently PHP is looking for the file in C:\include\fpdf153\fpdf.php
as it is an absolute path.
Try to put the file in C:\xampp\htdocs\aks\include\fpdf153\
and use the follwing statement:
require(include/fpdf153/fpdf.php
);
Then it uses a relative link based on your current working this (I guess it's C:\xampp\htdocs\aks\
). And it should work.
You can find more info in the PHP manual
回答2:
I think that the file path that you have used with the require function is wrong
回答3:
I presume that the name of root folder is a test.
/test
copy font folder and fpdf.php into /test
Example, Create sample.php into /test folder.
<?php
require('fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
回答4:
I think the fpdf.php is missin .I have searched on their site but i could not find the english version. can anyone provide me full link of english version?
Are you looking for that?
http://www.fpdf.org/en/dl.php?v=16&f=zip
回答5:
There is an API for FPDF so before using this you have to save all file in any folder then provide the path to this.
Then you will be able to use this.
回答6:
i think you should put all content of fpdf library inside the root folder of your project like follow
root(project folder)
- font(fpdf library fonts folder)
- makefont(fpdf library make font folder)`
- fpdf.php(fpdf file)
- index.php(your project file)
also include in your code by include_once('fpdf.php')
in your index.php
回答7:
All the files of the fpdf library should be inside your project.
I'd suggest you copy everything into a directory of you project. After that, it may look similar to this structure:
- root of project
- directory a
- directory b
- directory fpdf
- directory doc (many files inside)
- directory font (many files inside)
- directory makefont (many files inside)
- fpdf.css
- fpdf.php
- install.txt
- licence.txt
- directory c
- index.php
- ...
Then you can include it like so:
require('fpdf/fpdf.php');
See also: http://www.fpdf.org/
回答8:
when you are getting error in this line require('fpdf/fpdf.php'); that means you need to keep the folder in your current directory. what you can do is , you can go to the following url download any version zip file extract that make folder name 'fpdf' and save in current project location. it will work perfectly. Here is the url "http://www.fpdf.org/en/download.php"
来源:https://stackoverflow.com/questions/1339810/using-fpdf-library