나는 다음과 같은 JSON 문자열은 노드 JS 서비스에서 돌아 오는이 : 그래서PHP에서 JSON을 구문 분석하는 올바른 방법은 무엇입니까?
string '{"success":true,"isavailable":true}' (length=35)
:
"{\"success\":true,\"isavailable\":true}"
은 내가이 (가) 위해서 var_dump에서 다음을 얻을 PHP에서 json_decode()를 사용하려고 할 때 나는이 작업을 수행 할 때
$str = str_replace("\"{", "'{", $str);
$str = str_replace("}\"", "}'", $str);
$str = str_replace('\"','"',$str);
내가 돌아에서 구문 오류 마지막 오류 및 NULL의 값을 얻을 : 나는 다음을 수행하려고 설정합니다.
그래서 PHP에서이 JSON 문자열을 구문 분석하는 올바른 방법은 무엇입니까?
'json_decode'가 작동합니다 : http://codepad.org/LIBC8ihP –
'json_decode'는 PHP 5.2.0 이상에서만 사용할 수 있습니까? – AlexLittlejohn
@AlexLittlejohn 5.2.0보다 오래된 버전을 사용하는 이유는 무엇입니까? – Lusitanian