php
json 동적 사용하기
┌(  ̄∇ ̄)┘™
2016. 5. 31. 12:31
728x90
[원문] http://fosun.tistory.com/entry/php4-php51X%EB%8C%80%EC%97%90%EC%84%9C-json-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0
if (!function_exists('json_decode')) {
function json_decode($content, $assoc=false) {
require_once 'classes/JSON.php';
if ($assoc) {
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
}
else {
$json = new Services_JSON;
}
return $json->decode($content);
}
}
if (!function_exists('json_encode')) {
function json_encode($content) {
require_once 'classes/JSON.php';
$json = new Services_JSON;
return $json->encode($content);
}
}
728x90