【发布时间】:2017-06-23 20:13:05
【问题描述】:
我有一个类似...的html字符串
<match id="18" srs="ICC Womens World Cup Qualifier, 2010" mchDesc="BANW vs PMGW" mnum="4th Match">
使用 php 我如何将这个字符串拆分/解码/解析为可访问对象(键值对),例如......
array(
"id"=>"18",
"srs"=>"ICC Womens World Cup Qualifier, 2010",
"mchDesc"=>"BANW vs PMGW",
"mnum"=>"4th Match"
);
输出:
Array
(
[id] => 18
[srs] => ICC Womens World Cup Qualifier, 2010
[mchDesc] => BANW vs PMGW
[mnum] => 4th Match
)
【问题讨论】:
-
PHP String Split的可能重复
-
请看两个问题@Vintesh 的说明
标签: php regex xml-parsing attributes html-parsing