我正在尝试使用dompdf将我的html文档转换为pdf。但是,我收到了以下错误代码:解析错误:语法错误,在第6行的T_USE中意外地使用C:\xampp\htdocs\dompdf\pdf.php
我的代码如下:
<?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
发布于 2022-11-15 08:42:59
只需在;之后添加require_once 'dompdf/autoload.inc.php'
https://stackoverflow.com/questions/74442704
复制相似问题