我有一个xml文件,其中替换为&,&
然后将&
转换回&插入数据库。我的脚本没有用代替&&
。
function xml_entities($string) {
return strtr(
$string,
array(
"&" => "&",
)
);
}
$content=xml_entities(file_get_contents("http://www.site.com/feeds/xxxx/property.xml"));
file_put_contents("cleanme.xml",$content);
echo "File clean complete".'<br>';
$content=file_get_contents("http://www.site.com/feeds/xxxx/property.xml");
file_put_contents("cleanme.xml", str_replace("&", "&", $content));
echo "File clean complete".'<br>';
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句