问题
i want to make some reports with yii2 Mpdf but when i running the program i got an error like Call to undefined function Mpdf\mb_regex_encoding() please tell me how to solved this program
this is my controller
public function actionRpt($id)
{
$content = $this->renderPartial('rpt', [
'model' => $this->findModel($id),
]);
// setup kartik\mpdf\Pdf component
$pdf = new Pdf([
// set to use core fonts only
'mode' => Pdf::MODE_UTF8,
// A4 paper format
'format' => Pdf::FORMAT_A4,
// portrait orientation
'orientation' => Pdf::ORIENT_PORTRAIT,
// stream to browser inline
'destination' => Pdf::DEST_BROWSER,
// your html content input
'content' => $content,
// format content from your own css file if needed or use the
// enhanced bootstrap css built by Krajee for mPDF formatting
'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
// any css to be embedded if required
'cssInline' => '.kv-heading-1{font-size:18px}',
// set mPDF properties on the fly
'options' => ['title' => 'RPT NCR'],
// call mPDF methods on the fly
'methods' => [
'SetHeader'=>['NCR'],
'SetFooter'=>['{PAGENO}'],
]
]);
}
回答1:
You have to have mbstring
PHP extension enabled, including the mbregex
option, which needs to be explicitly enabled in some environments.
https://mpdf.github.io/about-mpdf/requirements-v7.html
来源:https://stackoverflow.com/questions/46951700/call-to-undefined-function-mpdf-mb-regex-encoding