【发布时间】:2013-12-21 17:23:22
【问题描述】:
路径:供应商/dompdf
我收到致命错误:第 313 行的 C:\wamp\www\sms_app\app\Controller\SentMessagesController.php 中找不到类 'DOMPDF'。
为什么我会出错?这是我的代码:
function example()
{
//App::import('Vendor','dompdf',array('file'=>'dompdf'.DS.'dompdf_config.inc.php'));
require_once(APP . 'Vendor' . DS . 'dompdf' . DS . 'dompdf_config.inc.php');
$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';
try{
$this->dompdf = new DOMPDF();
}
catch (Exception $e)
{
echo $e;
}
$papersize = "legal";
$orientation = 'landscape';
$this->dompdf->load_html($html);
$this->dompdf->set_paper($papersize, $orientation);
$this->dompdf->render();
$output = $this->dompdf->output();
file_put_contents('Brochure.pdf', $output);
}
【问题讨论】:
-
您可能需要确定应该加载类
DOMPDF并确保该类在使用之前存在,即debug around here。 -
我建议你使用美妙的CakePDF插件。