xml,array的转换 2014-07-11 php 12345678910111213141516171819202122232425//xml转为arraypublic function xmlToArray($xml){ $xml=simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); $array_data = json_decode(json_encode($xml), true); return $array_data;}//array转xmlpublic function arrayToXml($arr){ $xml = "<xml>"; foreach ($arr as $key=>$val) { if (is_numeric($val)) { $xml.="<".$key.">".$val."</".$key.">"; } else $xml.="<".$key."><![CDATA[".$val."]]></".$key.">"; } $xml.="</xml>"; return $xml;} Newer sublime text全程指南 Older MySQL运行状态show status中文详解