使用Dompdf生成pdf文件。该文件已成功创建并下载,但我正在运行它的页面生成了一个致命错误-未找到Class 'Dompdf\Dompdf‘。
我已经下载了最新的包并上传到服务器。
我正在使用这里的快速入门代码- https://github.com/dompdf/dompdf#easy-installation
require_once 'path/to/the/folder/here/dompdf/autoload.inc.php';
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream();我已经阅读了我能找到的所有相关的支持帖子,但似乎都不起作用
发布于 2021-07-31 09:01:26
试试这个
<?php
namespace Dompdf;
require_once 'dompdf/autoload.inc.php';
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream();
?>https://stackoverflow.com/questions/66598967
复制相似问题