java空白页_mpdf生成空白页面

我对mPDF 5.6有同样的问题 . 当我使用xdebug时,我找到了这两行:

$str = @preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);

$str = @preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);

正如您所看到的那样,“@”char阻止错误输出 . 因此,如果你有php> = 7.0,你永远不会得到关于弃用的“e”修饰符的错误 . 因此,在这些行之后,所有HTML都将为NULL .

我更新了这个功能:

// mpdf/includes/functions.php

if (!function_exists('strcode2utf')) {

function strcode2utf($str,$lo=true)

{

//converts all the nnn; and hhh; in a string to Unicode

if ($lo) { $lo = 1; } else { $lo = 0; }

// Deprecated modifier "E" in preg_replace

//$str = @preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str); // blocked errors output!! wtf?

//$str = @preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);

$str = preg_replace_callback('/\&\#([0-9]+)\;/m',

function($num) use ($lo) {

return code2utf($num, $lo);

}, $str);

$str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m',

function($num) use ($lo) {

return codeHex2utf($num, $lo);

}, $str);

return $str;

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值