调用未定义函数 Mpdf\mb_regex_encoding()
Call to undefined function Mpdf\mb_regex_encoding()
我想用 yii2 Mpdf 做一些报告但是当我 运行 程序时我得到了一个错误,比如 Call to undefined function Mpdf\mb_regex_encoding() 请告诉我如何解决这个程序
这是我的控制器
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}'],
]
]);
}
您必须启用 mbstring
PHP 扩展,包括 mbregex
选项,在某些环境中需要明确启用。
我想用 yii2 Mpdf 做一些报告但是当我 运行 程序时我得到了一个错误,比如 Call to undefined function Mpdf\mb_regex_encoding() 请告诉我如何解决这个程序
这是我的控制器
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}'],
]
]);
}
您必须启用 mbstring
PHP 扩展,包括 mbregex
选项,在某些环境中需要明确启用。