利用正则将xml数据解析为数组 此方法来源网络 无 function xml_to_array( $xml ){$reg = '/(\w+)[^]*([\x00-\xFF]*)\/\1/';if(preg_match_all($reg, $xml, $matches)){$count = count($matches[0]);for($i = 0; $i $count; $i++){$subxml= $matches[2][$i];$k
利用正则将xml数据解析为数组
function xml_to_array( $xml )
{
$reg = '/<(\w+)[^>]*>([\x00-\xFF]*)<\/\1>/';
if(preg_match_all($reg, $xml, $matches))
{
$count = count($matches[0]);
for($i = 0; $i < $count; $i++)
{
$subxml= $matches[2][$i];
$key = $matches[1][$i];
if(preg_match( $reg, $subxml ))
{
$arr[$key] = xml_to_array( $subxml );
}else{
$arr[$key] = $subxml;
}
}
}
return $arr;
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号