Top
# 사용법 1. json_decode 함수 선언 2. 클래스 생성 3. decode 하기 json.php 파일을 include 한 후에 ! 클래스를 선언합니다. $test = new Services_JSON(); 변수명 = $test->decode(decode할 값, true); 이렇게 사용하면 되는데 ! but... object를 못읽으므로 함수를 추가합니다 ! ★ 클래스 선언한 부분 위에 함수를 추가해 주세요 ! if ( !function_exists('json_decode') ){ function json_decode($json) { // Author: walidator.info 2009 $comment = false; $out = '$x='; for ($i=0; $i<strlen($json); $i++) { if (!$comment) { if ($json[$i] == '{') $out .= ' array('; else if ($json[$i] == '}') $out .= ')'; else if ($json[$i] == ':') $out .= '=>'; else $out .= $json[$i]; } else $out .= $json[$i]; if ($json[$i] == '"') $comment = !$comment; } eval($out . ';'); return $x; } }