[英]PHP Fatal Error – yii\base\ErrorException Class 'Dompdf\FrameDecorator\Page' not found
I am trying to us Dompdf in my yii2 application, but it's showing me an error message. 我正在yii2应用程序中尝试向我们发送Dompdf,但它向我显示错误消息。
PHP Fatal Error – yii\\base\\ErrorException Class PHP致命错误– yii \\ base \\ ErrorException类
'Dompdf\\FrameDecorator\\Page' not found 找不到'Dompdf \\ FrameDecorator \\ Page'
and I don't understand reason of that. 我不明白原因。
You should run this command to add this extension into your composer.json. 您应该运行此命令将此扩展名添加到composer.json中。
composer require dompdf/dompdf
OR add this line in your composer.json require section and run composer update
: 或者在您的composer.json require部分添加此行,然后运行composer update
:
"require": {
"dompdf/dompdf": "^0.7.0"
},
And then in your view access this way. 然后您认为以这种方式访问。
// 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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.