我下载了mpdf的更新版本,并将其与php一起使用。它给了我以下错误。
“致命错误:在第39行的E:\xampp\htdocs\PDF\mpdf\Mpdf.php中找不到特性‘Mpdf\严格’”。
$html = '<h2>mpdf test.</h2>';
include("mpdf/mpdf.php");
$mpdf = new mPDF('c','A4','','',32,25,27,25,16,13);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first
level of a list
// LOAD a stylesheet
$stylesheet = file_get_contents('mpdfstyletables.css');
$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
$mpdf->WriteHTML($html,2);
$mpdf->Output('mpdf.pdf','I');
exit;发布于 2019-05-13 10:19:58
您将直接包括mpdf
include("mpdf/mpdf.php");它只包含核心文件,而不包括生成过程中mPDF可能需要的任何其他文件。正确的方法是使用:
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
// Create an instance of the class:
$mpdf = new \Mpdf\Mpdf(); 这将确保所需的类一旦被引用就会自动加载。
有关更多信息,请查看“开始”网页上的mPDF章节。
https://stackoverflow.com/questions/56108934
复制相似问题