xml出现EntityRef: expecting ';'错误
今天无意中生成xml出现EntityRef: expecting ';'错误,找了原因发现是含有&,url中的&应该写成&php中只需要写个函数
//去除转义字符 function transferHtml($content) { $content=str_replace("<","<",$content); $content=str_replace(">",">",$content); $content=str_replace("&","",$content); $content=str_replace(""",'"',$content); $content=str_replace("'","'",$content); $content=str_replace("/","/",$content); $content=str_replace("“",'"',$content); $content=str_replace("”",'"',$content); $content=preg_replace("/&(.*?);/si","",$content); $content=str_replace("\\r","",$content); $content=str_replace("\\n","",$content); $content=str_replace("\\t","",$content); $content=str_replace("\\","",$content); return $content; }
这样就搞定了,演示:模块地图 (nongpin88.com)
千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。