Add encodeJSONCompact

This commit is contained in:
cmp167
2023-03-28 04:33:34 +12:00
parent 8329ec125b
commit e91e1cd2dc

View File

@@ -130,6 +130,19 @@
return null;
}
function encodeJSONCompact($obj) {
$text = json_encode($obj, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$err = json_last_error();
if($err === JSON_ERROR_NONE)
return $text;
$this->errorJSON($err);
return null;
}
function readFile($file) {
return @file_get_contents(
$file , // string