3 回答
TA贡献1860条经验 获得超8个赞
运行此命令:
sudo nano +1671 /usr/share/php/tcpdf/include/tcpdf_fonts.php
is_numeric($c)在公共方法主体中添加此条件,因此更改:
public static function unichr($c, $unicode=true) {
if (!$unicode) {
return chr($c);
} elseif ($c <= 0x7F) {
// one byte
return chr($c);
} elseif ($c <= 0x7FF) {
// two bytes
return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
} elseif ($c <= 0xFFFF) {
// three bytes
return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
} elseif ($c <= 0x10FFFF) {
// four bytes
return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
} else {
return '';
}
}
至
public static function unichr($c, $unicode=true) {
if (is_numeric($c)){
if (!$unicode) {
return chr($c);
} elseif ($c <= 0x7F) {
// one byte
return chr($c);
} elseif ($c <= 0x7FF) {
// two bytes
return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
} elseif ($c <= 0xFFFF) {
// three bytes
return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
} elseif ($c <= 0x10FFFF) {
// four bytes
return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
} else {
return '';
}
}
}
TA贡献2021条经验 获得超8个赞
一种快速的解决方案是降级您的 PHP 版本,假设您在 PHP 7.4 上运行。或者参考这个 URL https://github.com/tecnickcom/TCPPDF/pull/123/commits/34eb0dff48eb0b0d5f38f4cfd92ef6d47aefc8b4
使用 TCPDF 修复了此错误
- 3 回答
- 0 关注
- 103 浏览
添加回答
举报