codeigniter 3 中的 Mpdf 问题
Mpdf issue in codeigniter 3
我正在使用 codeigniter 3 开发一个项目,我使用的是 mpdf v5.6。
mpdf 示例运行完美,但是当我将 mpdf 与 codeigniter 3 集成时,它会抛出一些错误。
我的控制器代码是
public function pdf()
{
$this->load->library('mpdf');
$this->mpdf->WriteHTML('<p>Hello There</p>');
$this->mpdf->Output();
}
错误一样
A PHP Error was encountered
Severity: 8192
Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Filename: includes/functions.php
Line Number: 74
Backtrace:
File: /Users/bappa/Desktop/codeigniter/mpdf/includes/functions.php
Line: 74
Function: preg_replace
File: /Users/bappa/Desktop/codeigniter/application/libraries/Mpdf.php
Line: 31062
Function: strcode2utf
File: /Users/bappa/Desktop/codeigniter/application/libraries/Mpdf.php
Line: 12302
Function: purify_utf8
File: /Users/bappa/Desktop/codeigniter/application/controllers/Welcome.php
Line: 29
Function: WriteHTML
File: /Users/bappa/Desktop/codeigniter/index.php
Line: 292
Function: require_once
并在错误页面的末尾
mPDF error: Some data has already been output to browser, can't send PDF file
问题出在哪里?谢谢。
打开导致错误的那一行。我认为错误行是这样的,
$str = preg_replace('/&#([0-9]+)\;/me', "code2utf('',{$lo})",$str);
$str = preg_replace('/&#x([0-9a-fA-F]+)\;/me', "codeHex2utf('',{$lo})",$str);
将这些行替换为,
$str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return code2utf($m[1],$lo); }, $str);
$str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return codeHex2utf($m[1],$lo);}, $str);
在 github
中查看此问题
我正在使用 codeigniter 3 开发一个项目,我使用的是 mpdf v5.6。 mpdf 示例运行完美,但是当我将 mpdf 与 codeigniter 3 集成时,它会抛出一些错误。 我的控制器代码是
public function pdf()
{
$this->load->library('mpdf');
$this->mpdf->WriteHTML('<p>Hello There</p>');
$this->mpdf->Output();
}
错误一样
A PHP Error was encountered
Severity: 8192
Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Filename: includes/functions.php
Line Number: 74
Backtrace:
File: /Users/bappa/Desktop/codeigniter/mpdf/includes/functions.php
Line: 74
Function: preg_replace
File: /Users/bappa/Desktop/codeigniter/application/libraries/Mpdf.php
Line: 31062
Function: strcode2utf
File: /Users/bappa/Desktop/codeigniter/application/libraries/Mpdf.php
Line: 12302
Function: purify_utf8
File: /Users/bappa/Desktop/codeigniter/application/controllers/Welcome.php
Line: 29
Function: WriteHTML
File: /Users/bappa/Desktop/codeigniter/index.php
Line: 292
Function: require_once
并在错误页面的末尾
mPDF error: Some data has already been output to browser, can't send PDF file
问题出在哪里?谢谢。
打开导致错误的那一行。我认为错误行是这样的,
$str = preg_replace('/&#([0-9]+)\;/me', "code2utf('',{$lo})",$str);
$str = preg_replace('/&#x([0-9a-fA-F]+)\;/me', "codeHex2utf('',{$lo})",$str);
将这些行替换为,
$str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return code2utf($m[1],$lo); }, $str);
$str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return codeHex2utf($m[1],$lo);}, $str);
在 github
中查看此问题