首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到Dompdf类'Dompdf\Dompdf‘

找不到Dompdf类'Dompdf\Dompdf‘
EN

Stack Overflow用户
提问于 2021-03-12 19:21:18
回答 1查看 215关注 0票数 0

使用Dompdf生成pdf文件。该文件已成功创建并下载,但我正在运行它的页面生成了一个致命错误-未找到Class 'Dompdf\Dompdf‘。

我已经下载了最新的包并上传到服务器。

我正在使用这里的快速入门代码- https://github.com/dompdf/dompdf#easy-installation

代码语言:javascript
复制
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();

我已经阅读了我能找到的所有相关的支持帖子,但似乎都不起作用

EN

回答 1

Stack Overflow用户

发布于 2021-07-31 09:01:26

试试这个

代码语言:javascript
复制
<?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();
?>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66598967

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档