我有dompdf的问题,它在localhost上运行得很好,但绝对不能在线:
pdf尚未生成,但会显示在浏览器上:我的代码:
<?php ob_start();?>
//My code
<?php $html = ob_get_clean();
require_once 'dompdf/autoload.inc.php';
?>
<?php
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream(); ?>
Votre paiement a bien été pris en compte.
<?php
$output = $dompdf->output();
file_put_contents("factures/".$nbr.".pdf", $output);
?>