截取多个JSON的参数值遇到有关问题

WBOY
Release: 2016-06-13 11:54:45
Original
856 people have browsed it

截取多个JSON的参数值遇到问题。
POST获取的JSON数据  [{"Name":"PM","Value":"224"},{"Name":"WD","Value":"25"},{"Name":"SD","Value":"34"},]

如何截取 Name=WD 的Value?
求代码。
------解决方案--------------------

$json = '[{"Name":"PM","Value":"224"},{"Name":"WD","Value":"25"},{"Name":"SD","Value":"34"}]';<br />$jsonArr = json_decode($json) ;<br />foreach ($jsonArr as  $value) {<br />	if($value->Name == 'WD'){<br />		echo $value->Value."<br />";<br />	}<br />}<br /><br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!