试图通过composer包含setasign / fpdf

问题描述:

I'm trying to include fpdf and fpdi via installing setasign/fpdi-fpdf through composer but I can't seem to get fpdf or fpdi loaded. The error I get is Class 'setasign\fpdf\FPDF' not found.

use \setasign\fpdf\FPDF as FPDF;

//inside controller function
fpdf::AddPage();
fpdf::SetFont('Courier', 'B', 18);
fpdf::Cell(50, 25, 'Hello World!');
fpdf::Output();

Maybe I should be adding something to the config/app.php file in order to load the classes?

我试图通过安装 setasign / fpdi-fpdf code>来包含fpdf和fpdi 作曲家,但我似乎无法得到fpdf或fpdi加载。 我得到的错误是 Class'setasign \ fpdf \ FPDF'not found code>。 p>

  use \ setasign \ fpdf \ FPDF as FPDF;​​ 
 \  n //控制器内部函数
fpdf :: AddPage(); 
fpdf :: SetFont('Courier','B',18); 
fpdf :: Cell(50,25,'Hello World!'); 
fpdf  :: Output(); 
  code>  pre> 
 
 

也许我应该在 config / app.php code>文件中添加一些内容以加载类 ? p> div>

FPDF is not namespaced. The package is a clone of the original release with an additional composer.json file. Nothing more.

Just use \FPDF if you want to use the FPDF class.

The latest FPDI release is namespaced: \setasign\Fpdi\Fpdi

Additionally you should/cannot call the methods static.