think-template icon indicating copy to clipboard operation
think-template copied to clipboard

修改默认过滤方法使用内置的函数而非htmlentities以兼容PHP8.1

Open augushong opened this issue 3 years ago • 0 comments

默认的过滤方法为htmlentities,然而在PHP8.1中,这个函数的表现发生了变化,第一个参数只接受string, 需要在类库中内置一个自定义的函数,然后调用htmlentities.

if (!function_exists('tp_htmlentities')) {
    function tp_htmlentities($string)
    {
        if (is_null($string)) {
            $string = '';
        }

        return htmlentities($string);
    }
}

augushong avatar Mar 18 '22 14:03 augushong