在 codeigniter return 错误中使用 mpdf 库

Using mpdf library in codeigniter return error

错误

A PHP Error was encountered

Severity: Warning

Message: preg_match() expects parameter 2 to be string, object given

Filename: libraries/mpdf.php

Line Number: 22307

回溯:

文件:D:\xamp\htdocs\ci_test\application\libraries\mpdf.php 线路:22307 函数:preg_match

文件:D:\xamp\htdocs\ci_test\application\libraries\mpdf.php 线路:13118 函数:读取字符集

文件:D:\xamp\htdocs\ci_test\application\controllers\Welcome.php 线路:28 函数:写HTML

文件:D:\xamp\htdocs\ci_test\index.php 线路:292 函数:require_once

这是我的控制器

    $this->load->library('mpdf');

    $html = $this->load->view('welcome_message');

    $this->mpdf->WriteHTML($html);
    $this->mpdf->Output();

尝试像这样加载视图,

$html = $this->load->view('welcome_message','',TRUE);
                                               ^ will get the value to variable.