使用dompdf和codeigniter的问题

Max*_*axQ 0 php codeigniter dompdf

我已经开始尝试使用codeigniter和pdfs.我正在使用两者的最新版本.出于某种原因,我在尝试渲染pdfs时遇到此错误:

Warning: require_once(C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf/include/ci_exceptions.cls.php) [function.require-once]: failed to open stream: No such file or directory in C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf\dompdf_config.inc.php on line 208

Fatal error: require_once() [function.require]: Failed opening required 'C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf/include/ci_exceptions.cls.php' (include_path='.;C:\php\pear') in C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf\dompdf_config.inc.php on line 208
Run Code Online (Sandbox Code Playgroud)

使用的代码是:

function pdf()
    {
         $this->load->helper(array('dompdf', 'file'));
         // page info here, db calls, etc.     

         /*
         $data=array(
         "$title"=>"Hello!",
         "$test_questions"=>"1,2,3,4",
         );
         */

        $data['test_questions']= "hello";


         $html = $this->load->view('pdf/test_ibdp', $data, true);

         $filename="Test".$data['test_questions'];

         pdf_create($html, $filename);
         write_file('name', $data);

    }   
Run Code Online (Sandbox Code Playgroud)

帮助者:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $filename, $stream=TRUE) 
{
    require_once("dompdf/dompdf_config.inc.php");

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_paper("a4", "portrait" );
    $dompdf->render();
    $dompdf->stream($filename . ".pdf");
}
?>  
Run Code Online (Sandbox Code Playgroud)

和视图(纯HTML)

<html>
<head>
<title>Hello!</title>
</head>
<body>
    <h1>HelloAgain</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

有什么建议?我不是那种经验丰富的PHP,我很困惑.我刚刚重新下载了这个库,我试着通过剥离代码中的附加内容来保持它非常简单.似乎没什么用.任何帮助都会很棒:)

Fab*_*ger 5

这是一个类自动加载器问题.你使用哪个版本的DOMPDF?我认为dompdf 0.5在集成到像CI这样的框架中时会出现问题.0.6版本不再存在这个问题,如果问题仍然存在,请写信

define("DOMPDF_AUTOLOAD_PREPEND", true)
Run Code Online (Sandbox Code Playgroud)

dompdf_config.custom.inc.php.