我没有设法在laravel 4上安装FPDF. 你能帮助我吗? 你能一步一步解释怎么做吗?
I didn't manage to install FPDF on laravel 4. Can you help me? Can you explain how to do it step by step?
我添加composer.json
"require": { "illuminate/support": "4.0.x" }, "require-dev": { "anouar/fpdf": "dev-master" },在此之后,在shell上,我使用composer更新.现在呢?
after this, on shell, I use composer update. And now?
推荐答案在您的composer.json文件中,添加:
To your composer.json file, add:
"require-dev": { "anouar/fpdf": "dev-master" }然后更新您的Laravel项目,
Then update your Laravel project,
composer update如果尚未安装laravel框架,请使用
If not already installed laravel framework use,
composer install然后转到app/config/app.php并添加provider数组,
Then go to app/config/app.php and to the providers array add,
'Anouar\Fpdf\FpdfServiceProvider',现在看起来像
'providers' => array( // ... 'Anouar\Fpdf\FpdfServiceProvider', )最后,在别名数组中将别名添加到app/config/app.php中.
Finally, add the alias to app/config/app.php, within the aliases array.
'aliases' => array( // ... 'Fpdf' => 'Anouar\Fpdf\Facades\Fpdf', )现在您可以在任何地方使用Fpdf,
Now you can use Fpdf anywhere like,
在app/routes.php中
In app/routes.php
Route::get('pdf', function(){ Fpdf::AddPage(); Fpdf::SetFont('Arial','B',16); Fpdf::Cell(40,10,'Hello World!'); Fpdf::Output(); exit; });然后使用您的网址进行测试,
Then test it with your url like,
localhost/laravel/pdf您可以看到Packagist packagist/packages/anouar/fpdf
You can see the Packagist packagist/packages/anouar/fpdf
此处还有GitHub Repo github/xroot/laravel-fpdf
And the GitHub Repo here github/xroot/laravel-fpdf
更多推荐
在Laravel 4上安装FPDF
发布评论