この拡張子をcomposer.jsonに追加するには、このコマンドを実行する必要があります。
composer require dompdf/dompdf
やあなたのcomposer.jsonにこの行を追加するセクションを必要としcomposer update
を実行します。
ビューのアクセスで
"require": {
"dompdf/dompdf": "^0.7.0"
},
そして、この方法を。
// 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();
'Use Dompdf \ Dompdf;'この行をファイルの先頭に置きます。 –
@MuhammadShahzadあなたはどこからそれを得ていますか? 'Page'の名前空間は[' Dompdf \ FrameDecorator'](https://github.com/dompdf/dompdf/blob/master/src/FrameDecorator/Page.php#L8) – Phil
@Philです。https://を確認してくださいgithub.com/dompdf/dompdf –