修改如下文件中自定义的match
函数,因为php8自带了一个match函数,功能不一样
/app/function/common.function.php
/app/function/helper.function.php
/app/sdks/lessc.class.php
/app/controller/app.class.php
match
批量替换为其他名字,如我替换为了matching
修改/app/function/common.function.php
中msubstr
函数参数,为$length
添加默认参数,因为php8规定了不带默认值的参数不能放在带默认值的参数后面。修改示例:
function msubstr($str, $start = 0, $length = 0, $charset = "utf-8", $suffix = true){
if (function_exists("mb_substr")) {
$i_str_len = mb_strlen($str);
$s_sub_str = mb_substr($str, $start, $length, $charset);
if ($length >= $i_str_len) {
return $s_sub_str;
}
return $s_sub_str . '...';
} elseif (function_exists('iconv_substr')) {
return iconv_substr($str, $start, $length, $charset);
}
$re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
$re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
$re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
$re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
preg_match_all($re[$charset], $str, $match);
$slice = join("", array_slice($match[0], $start, $length));
if ($suffix) return $slice . "…";
return $slice;
}
之后有遇到问题再在回帖里面记录:blush: