相关疑难解决方法(0)

PHP致命错误:第30行找不到类'DOMPDF'

我正在使用DOMPDF从HTML生成PDF.我已经从github(编码分支)复制了所有必需的文件.但是它说类DOMPDF没有错误,如下所示.

链接为gitbub中的dompdf_config.inc.php:https://github.com/dompdf/dompdf/tree/encoding

这是我的代码:

require_once("APIs/dompdf-encoding/dompdf_config.inc.php");     
$cart_body='<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>New Order Placed</title></head><body><p>Test Printing...</p></body></html>';
        $dompdf = new DOMPDF();
        $dompdf->load_html($cart_body);//body -> html content which needs to be converted as pdf..
        $dompdf->render();
        $dompdf->stream("sample.pdf"); //To popup pdf as download
Run Code Online (Sandbox Code Playgroud)

实际产出是:

致命错误:第30行/home/web/www/test_dompdf.php中找不到"DOMPDF"类

30号线是 $dompdf = new DOMPDF();

注意:其他Master Branch工作正常.我需要这个编码分支,因为它解决了编码字体相关的问题.

php pdf dompdf

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

dompdf ×1

pdf ×1

php ×1