调用未定义的函数 Mpdf\mb_regex_encoding() [英] Call to undefined function Mpdf\mb_regex_encoding()

查看:25
本文介绍了调用未定义的函数 Mpdf\mb_regex_encoding()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 yii2 Mpdf 做一些报告,但是当我运行程序时,我收到了一个错误,如 Call to undefined function Mpdf\mb_regex_encoding() 请告诉我如何解决这个程序

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

这是我的控制器

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 选项,需要明确在某些环境中启用.

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

这篇关于调用未定义的函数 Mpdf\mb_regex_encoding()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆