Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我得到了这个 json,但我不知道如何通过知道 ID 来获取名称。
[ { "id":0, "name":"N/A" }, { "id":1, "name":"John" }, { "id":2, "name":"Doom" } ]
我在尝试着 :
$json= file_get_contents($json); $data = json_decode($json,true);
但我不知道下一步该做什么.. :(
只包括 underscore.js 并做类似的事情
_.each(json, function(datum){ if ( yourid === datum.id ) { //yourcode } });