我已经开始尝试使用 codeigniter 和 pdf。我正在使用两者的最新版本。出于某种原因,我在尝试渲染 pdf 时遇到此错误:
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
使用的代码是:
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);
}
和帮手:
<?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");
}
?>
和视图(纯 HTML)
<html>
<head>
<title>Hello!</title>
</head>
<body>
<h1>HelloAgain</h1>
</body>
</html>
有什么建议么?我在 PHP 方面没有那么有经验,我很困惑。我刚刚重新下载了该库,我尝试通过删除代码中的额外内容来保持它非常简单。似乎没有任何效果。任何帮助都会很棒:)