eee
This commit is contained in:
+34
-10
@@ -44,7 +44,7 @@ if (!function_exists('isJson')) {
|
|||||||
{
|
{
|
||||||
if (is_null($string)) return false;
|
if (is_null($string)) return false;
|
||||||
return (str_starts_with($string, '{') && str_ends_with($string, '}'))
|
return (str_starts_with($string, '{') && str_ends_with($string, '}'))
|
||||||
|| (str_ends_with($string, '[') && str_starts_with($string, ']'));
|
|| (str_ends_with($string, '[') && str_starts_with($string, ']'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,6 @@ if (!function_exists('instance')) {
|
|||||||
if (!function_exists('call')) {
|
if (!function_exists('call')) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $handler
|
* @param $handler
|
||||||
* @param mixed ...$params
|
* @param mixed ...$params
|
||||||
@@ -250,6 +249,32 @@ if (!function_exists('isUrl')) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('msgpack_pack')) {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $content
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function msgpack_pack($content): string
|
||||||
|
{
|
||||||
|
return serialize($content);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!function_exists('msgpack_unpack')) {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $content
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function msgpack_unpack($content): mixed
|
||||||
|
{
|
||||||
|
return unserialize($content);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (!function_exists('request')) {
|
if (!function_exists('request')) {
|
||||||
|
|
||||||
@@ -307,7 +332,6 @@ if (!function_exists('split_request_uri')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('redis')) {
|
if (!function_exists('redis')) {
|
||||||
|
|
||||||
|
|
||||||
@@ -597,11 +621,11 @@ if (!function_exists('get_file_extension')) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$explode = explode('.', $filename);
|
$explode = explode('.', $filename);
|
||||||
$ext = strtolower(array_pop($explode));
|
$ext = strtolower(array_pop($explode));
|
||||||
if (array_key_exists($ext, $mime_types)) {
|
if (array_key_exists($ext, $mime_types)) {
|
||||||
return $ext;
|
return $ext;
|
||||||
} else if (function_exists('finfo_open')) {
|
} else if (function_exists('finfo_open')) {
|
||||||
$fInfo = finfo_open(FILEINFO_MIME);
|
$fInfo = finfo_open(FILEINFO_MIME);
|
||||||
$mimeType = finfo_file($fInfo, $filename);
|
$mimeType = finfo_file($fInfo, $filename);
|
||||||
finfo_close($fInfo);
|
finfo_close($fInfo);
|
||||||
$mimeType = current(explode('; ', $mimeType));
|
$mimeType = current(explode('; ', $mimeType));
|
||||||
@@ -832,13 +856,13 @@ if (!function_exists('jTraceEx')) {
|
|||||||
function jTraceEx($e, $seen = NULL, bool $toHtml = FALSE): string
|
function jTraceEx($e, $seen = NULL, bool $toHtml = FALSE): string
|
||||||
{
|
{
|
||||||
$starter = $seen ? 'Caused by: ' : '';
|
$starter = $seen ? 'Caused by: ' : '';
|
||||||
$result = [];
|
$result = [];
|
||||||
if (!$seen) $seen = [];
|
if (!$seen) $seen = [];
|
||||||
$trace = $e->getTrace();
|
$trace = $e->getTrace();
|
||||||
$prev = $e->getPrevious();
|
$prev = $e->getPrevious();
|
||||||
$result[] = sprintf('%s%s: %s', $starter, $e::class, $e->getMessage());
|
$result[] = sprintf('%s%s: %s', $starter, $e::class, $e->getMessage());
|
||||||
$file = $e->getFile();
|
$file = $e->getFile();
|
||||||
$line = $e->getLine();
|
$line = $e->getLine();
|
||||||
|
|
||||||
foreach ($trace as $value) {
|
foreach ($trace as $value) {
|
||||||
$result[] = sprintf(' at %s%s%s(%s%s%s)',
|
$result[] = sprintf(' at %s%s%s(%s%s%s)',
|
||||||
|
|||||||
Reference in New Issue
Block a user