json_encode시 null을 없애기 위한 코드 추가
This commit is contained in:
+18
@@ -249,6 +249,24 @@ function dictToArray($dict, $keys){
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function eraseNullKey(&$dict, $depth=512){
|
||||||
|
//TODO:Test 추가
|
||||||
|
if($depth <= 0){
|
||||||
|
return $dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($arr as $key=>$value) {
|
||||||
|
if($value === null){
|
||||||
|
unset($dict[$key]);
|
||||||
|
}
|
||||||
|
else if(is_array($value)){
|
||||||
|
$dict[$key] = eraseNullKey($value, $depth - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dict;
|
||||||
|
}
|
||||||
|
|
||||||
function parseJsonPost(){
|
function parseJsonPost(){
|
||||||
// http://thisinterestsme.com/receiving-json-post-data-via-php/
|
// http://thisinterestsme.com/receiving-json-post-data-via-php/
|
||||||
// http://thisinterestsme.com/php-json-error-handling/
|
// http://thisinterestsme.com/php-json-error-handling/
|
||||||
|
|||||||
Reference in New Issue
Block a user