implement usr_msg_id
This commit is contained in:
@@ -196,4 +196,22 @@ function api_return($http_code, $message)
|
||||
http_response_code($http_code);
|
||||
echo $message;
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param String $str
|
||||
* @param String[] $path
|
||||
*/
|
||||
function try_json($str, $path)
|
||||
{
|
||||
try
|
||||
{
|
||||
$o = json_decode($str);
|
||||
foreach ($path as $p) $o = $o[$p];
|
||||
return $o;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user