特定の要素に関連する問題を取得し、

WBOY
リリース: 2016-06-13 13:27:03
オリジナル
956 人が閲覧しました

特定の要素の取得に関する問題、緊急
{"head":[{"visitcode":"sjbtg","re​​sultCode":"0"}],"content":[{"userID":"15611030868", " productID":"3111007900 ","orderTime":"2012-06-19","orderType":"1","orderresult":"6","orderremark":"入力された商品IDは存在しません", "baseLine ":"","orderField":""},{"userID":"","productID":"","orderTime":"","orderType":"1","orderresult":" 1" ,"orderremark":"必須パラメータが空です","baseLine":"","orderField":""},{"userID":"","productID":"","orderTime":" " ,"orderType":"1","orderresult":"1","orderremark":"必須パラメータが空です","baseLine":""}]}

の取得方法 " orderresult" ": "6" の値、つまり 6

-----解決策-----------
$s = '{"head":[{"visitcode":"sjbtg","re​​sultCode":"0"}],"content":[{"userID":"15611030868","productID":"3111007900 " ,"orderTime":"2012-06-19","orderType":"1","orderresult":"6","orderremark":"入力された商品IDは存在しません","baseLine":"", " orderField":""},{"userID":"","productID":"","orderTime":"","orderType":"1","orderresult":"1","orderremark": " 必須の入力パラメータは空です","baseLine":"","orderField":""},{"userID":"","productID":"","orderTime":"","orderType": " 1","orderresult":"1","orderremark":"必須パラメータが空です","baseLine":""}]} ';

echo json_decode($s)-> content[0]->orderresult; //6

------解決策---------

話し合う

$s = '{"head":[{"visitcode":"sjbtg","re​​sultCode":"0"}],"content":[{"userID":"15611030868"," productID ":"3111007900 ","orderTime":"2012-06-19","orderType":"1","orderresult":"6","orderremark":"入力された製品 ID は存在しません...
関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!