天天看点

php’s json_decode函数

json_decode - 对 JSON 格式的字符串进行编码

mixed json_decode( string $json)

This function only works with UTF-8 encoded data.

<?php

$json = '{"foo-bar": 12345}';

$obj = json_decode($json);

print $obj->{'foo-bar'}; // 12345

?>

原文

http://www.php.net/manual/zh/function.json-decode.php