Add encodeJSONCompact
This commit is contained in:
13
cmpUtil.php
13
cmpUtil.php
@@ -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
|
||||
|
Reference in New Issue
Block a user