在Laravel 4上安装FPDF

编程入门 行业动态 更新时间:2024-10-10 12:24:49
本文介绍了在Laravel 4上安装FPDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我没有设法在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

本文发布于:2023-11-02 07:22:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551736.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Laravel   FPDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!