Call to undefined function Mpdf\mb_regex_encoding()

强颜欢笑 提交于 2020-12-29 19:47:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!