天天看點

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