PHP XMLºÍÊý×黥Ïàת»»
//Êý×éתXML
function arrayToXml($arr)
{
$xml = "";
foreach ($arr as $key=>$val)
{
if (is_numeric($val)){
$xml.="".$val."";
}else{
$xml.="";
}
}
$xml.="";
return $xml;
}
//½«XMLתΪarray
function xmlToArray($xml)
{
//½ûÖ¹ÒýÓÃÍⲿxmlʵÌå
libxml_disable_entity_loader(true);
$values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
return $values;
}
页:
[1]