This commit is contained in:
2023-12-12 15:35:38 +08:00
parent 827fb257ab
commit 84c253a9f6
17 changed files with 271 additions and 302 deletions
+6 -6
View File
@@ -14,9 +14,9 @@ use Exception;
class Str
{
const STRING = 'abcdefghijklmnopqrstuvwxyz';
const string STRING = 'abcdefghijklmnopqrstuvwxyz';
const NUMBER = '01234567890';
const string NUMBER = '01234567890';
/**
* @param int $length
@@ -107,7 +107,7 @@ class Str
*/
public static function isSerialize($data, $callBack = NULL): bool
{
$false = !empty($data) && swoole_unserialize($data) !== FALSE;
$false = !empty($data) && unserialize($data) !== FALSE;
if ($false && is_callable($callBack, TRUE)) {
return call_user_func($callBack, $data);
}
@@ -172,10 +172,10 @@ class Str
public static function filename($file, $type): string
{
return match ($type) {
'image/png' => md5_file($file) . '.png',
'image/png' => md5_file($file) . '.png',
'image/jpeg', 'image/jpg' => md5_file($file) . '.jpg',
'image/gif' => md5_file($file) . '.gif',
default => md5_file($file),
'image/gif' => md5_file($file) . '.gif',
default => md5_file($file),
};
}