DETAILS
I am getting the following json data back via an ajax response.
"result":[{"word":"jquery","wordID":"1"},{"word":"github","wordID":"2"}]
I am trying to understand the information I've received (arrays confuse me). To do that I am trying to recreate the structure of the array in php.
If I were to recreate the array above would I write it like this?
$result=Array (
[0] => Array (
word => jquery
wordID => 1
)
[1] => Array (
word => github
wordID => 2
)
If no, how would I write it? Thanks.
使用json_decode
转换数组中的json,然后执行var_dump
以查看结构是否是您需要的
JSON is essentially the right-hand side of an assignment operation in Javascript, eg
var foo = [1,2,3];
^^^^^^^--- basically json
Your snippet above is, however, NOT valid json. You've got an object, which cannot simply show up as
"key":"value"
it has to be
{"key":"value"}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.