Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
DOMPDF+;Codeigniter,库升级,但现在不工作_Codeigniter_Dompdf - Fatal编程技术网

DOMPDF+;Codeigniter,库升级,但现在不工作

DOMPDF+;Codeigniter,库升级,但现在不工作,codeigniter,dompdf,Codeigniter,Dompdf,我一直在使用codeigniter中旧版本的dom pdf生成pdf,最近我将核心dompdf目录更改为更新版本dompdf-0.5.2.zip。 下面是我用来连接dompdf类的代码: class Pdf{ var $_dompdf = NULL; /** * Constructor Method **/ function __construct(){ ini_set("memory_limit", "1G"); require_once("Dompdf/dompdf_c

我一直在使用codeigniter中旧版本的dom pdf生成pdf,最近我将核心dompdf目录更改为更新版本dompdf-0.5.2.zip。 下面是我用来连接dompdf类的代码:

class Pdf{

var $_dompdf = NULL;

/**
 * Constructor Method
**/
function __construct(){
    ini_set("memory_limit", "1G");
    require_once("Dompdf/dompdf_config.inc.php");
    if(is_null($this->_dompdf)){
        $this->_dompdf = new DOMPDF();
    }
}

/**
 * HTML to PDF Conversion method
**/
function convert_html_to_pdf($_html, $_filename = '', $_stream = false, $_orientation = "portrait"){
    $this->_dompdf->set_paper("a4", $_orientation);
    $this->_dompdf->load_html($_html);
    $this->_dompdf->render();
    if($_stream){
        $this->_dompdf->stream($_filename);
    } else{
        file_put_contents($_filename, $this->_dompdf->output()); 
    }
}
}

现在,当我尝试生成pdf时,会出现以下错误: 致命错误:在第21行的D:\xampp\htdocs\app\application\libraries\Pdf.php中找不到类“dompd”

任何解决方案都将不胜感激


Thanx

请首先尝试使用此示例。只需将其存储在xampp或您正在使用的任何服务器的htdocs目录下的文件中

<?php
require_once("dompdf_config.inc.php");

$html =
 '<html><body>'.
 '<p>Put your html here, or generate it with your favourite '.
 'templating system.</p>'.
 '</body></html>';

 $dompdf = new DOMPDF();
 $dompdf->load_html($html);
 $dompdf->render();
 $dompdf->stream("sample.pdf");

?>


只需根据您的要求更改dompdf目录路径。

我通过将dompdf版本上载到最新版本解决了这个问题,尽管它是测试版,但现在似乎一切都很好。

我通过将当前版本升级到最新版本解决了这个问题。