我如何在没有作曲家的情况下安装mpdf 7? [英] How do I install mpdf 7 without composer?
问题描述
我当前正在使用mpdf 6.1,我想切换到7.但是我找不到在没有作曲家的情况下安装 的方法.是否有完整的软件包可以在本地主机上下载,解压缩和测试?
I'm currently using mpdf 6.1 and I'd like to switch to 7. But I can't find a way to install it without composer. Is there a full package that I can download, unzip and test on my localhost?
推荐答案
好吧,我花了几天的时间寻找一种方法,最后我找到了它,您可以在 codeigniter 一起使用,因此我在库文件夹中制作了一些php文件来加载它.
well, i've spend few days to search a way, finally i found it, you can download full package mpdf in this site, after download extract files and place on your project and load 'vendor/autoload.php'. in my case i use it with codeigniter, so i make some php file on libraries folder to load it.
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class M_pdf
{
function __construct()
{
include_once APPPATH.'libraries\vendor\autoload.php';
}
function pdf()
{
$CI = & get_instance();
log_message('Debug', 'mPDF class is loaded.');
}
function load($param=[])
{
return new \Mpdf\Mpdf($param);
}
}
之后,我在控制器文件上使用它:
after that i use it on my controller file :
$this->load->library('M_pdf');
$mpdf = $this->m_pdf->load([
'mode' => 'utf-8',
'format' => 'A4'
]);
$mpdf->WriteHTML("Hello World!");
$mpdf->Output();
但是我仍然建议您也使用作曲家,
but i still recommend to use composer as well,
这篇关于我如何在没有作曲家的情况下安装mpdf 7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!