首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我在使用dompdf运行我的php代码时出错?

为什么我在使用dompdf运行我的php代码时出错?
EN

Stack Overflow用户
提问于 2022-11-15 08:40:12
回答 1查看 23关注 0票数 0

我正在尝试使用dompdf将我的html文档转换为pdf。但是,我收到了以下错误代码:解析错误:语法错误,在第6行的T_USE中意外地使用C:\xampp\htdocs\dompdf\pdf.php

我的代码如下:

代码语言:javascript
复制
<?php

require_once '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();

?>

我使用了以下文档来帮助开发上面的代码:https://github.com/dompdf/dompdf

EN

回答 1

Stack Overflow用户

发布于 2022-11-15 08:42:59

只需在;之后添加require_once 'dompdf/autoload.inc.php'

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74442704

复制
相关文章

相似问题

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