本文介绍了带CODEIGNITER的DOMPDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使dompdf与codeigniter一起使用,我从此处版本是0.7.0,然后我在控制器中放入了这样的代码

I am trying to get dompdf working with codeigniter, I download the file from here https://github.com/dompdf/dompdf/releases the version was 0.7.0 and then I put inside my controller a piece of code like this

public function generatepdf(){

        $this->load->helper('file');
        require_once(APPPATH.'third_party/dompdf/autoload.inc.php');

         $domdpf = new DOMPDF();
         $domdpf -> loadHtml('<h1>HELLO WORLD</h1>');
         $domdpf -> setPaper('A4','Landscape');
         $domdpf ->render();

         $domdpf->stream();


    }

但是我收到一个错误,说
致命错误:在C:\Apache24\htdocs\faceloan\faceloan\application\controllers\moneyexchange.php行2495上找不到类'DOMPDF'

But I am getting a error saying Fatal error: Class 'DOMPDF' not found in C:\Apache24\htdocs\faceloan\faceloan\application\controllers\moneyexchange.php on line 2495

推荐答案

您需要使用v0.6。 v0.7使用CodeIgniter不支持的命名空间。

You need to use v0.6. v0.7 uses namespaces which are not supported in CodeIgniter.

这篇关于带CODEIGNITER的DOMPDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 13:05