如何避免这段字符串,为数组赋值

WBOY
Release: 2016-06-13 10:35:16
Original
790 people have browsed it

如何处理这段字符串,为数组赋值
如何处理这段字符串:
"BronzeList":[],"GoldList":["ATM054000"],"SilverList":["ATW099000"],"nation":"GER","nationName":"德国","rank":1,"rankTotal":1,"sortRank":1,"sortRankTotal":1,"totalBronze":8,"totalGold":8,"totalMedal":22,"totalSilver":6
来为数组赋值$array($key=>$value),使用逗号分割字符串,每项使冒号前面的内容为数组的$key,冒号后面的内容为数组的$value。
赋值的数组结果例如:$array = ("BronzeList"=>null,"GoldList"=>"ATM054000","SilverList"=>"ATW099000","nation"=>"GER",,,,)

求大侠帮忙。

------解决方案--------------------
他不是 json 吗?
------解决方案--------------------

PHP code
$json='{"BronzeList":[],"GoldList":["ATM054000"],"SilverList":["ATW099000"],"nation":"GER","nationName":"德国","rank":1,"rankTotal":1,"sortRank":1,"sortRankTotal":1,"totalBronze":8,"totalGold":8,"totalMedal":22}';print_r(json_decode($json,true));<div class="clear">
                 
              
              
        
            </div>
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!