兼容PHP8.1

This commit is contained in:
2022-07-21 09:41:22 +08:00
parent d9b337629f
commit da8b9b5e30
4 changed files with 29 additions and 4 deletions

View File

@@ -13,5 +13,5 @@ namespace app;
class Request extends \think\Request class Request extends \think\Request
{ {
protected $filter = ['ua_htmlspecialchars'];
} }

View File

@@ -129,7 +129,7 @@ function save_url_file($url, $type)
$model_file->save_name = $save_name; $model_file->save_name = $save_name;
$model_file->save(); $model_file->save();
unlink($temp_file);
return $save_name; return $save_name;
} }
@@ -276,3 +276,28 @@ function app_url(string $url = '', array $vars = [], $suffix = true, $domain = f
return url($url, $vars, $suffix, $domain); return url($url, $vars, $suffix, $domain);
} }
if (!function_exists('ua_htmlspecialchars')) {
function ua_htmlspecialchars($string)
{
if (is_null($string)) {
$string = '';
}
return htmlspecialchars($string);
}
}
if (!function_exists('ua_htmlentities')) {
function ua_htmlentities($string)
{
if (is_null($string)) {
$string = '';
}
return htmlentities($string);
}
}

View File

@@ -22,4 +22,6 @@ return [
'taglib_begin' => '{', 'taglib_begin' => '{',
// 标签库标签结束标记 // 标签库标签结束标记
'taglib_end' => '}', 'taglib_end' => '}',
'default_filter' => 'ua_htmlentities', // 默认过滤方法 用于普通标签输出
]; ];

2
runtime/.gitignore vendored
View File

@@ -1,2 +0,0 @@
*
!.gitignore