ICE NoteBook
2009年2月1日 星期日
PHP - XML保留字
【<、>、%、"、'】這五個符號都算是XML的保留字
如果傳送的字串沒有用CDATA包起來的話就會發生錯誤
這裡有寫好一個簡單function,合用就拿去用吧 有更好了也請通知我喔!!
function createXml( $str ){ $str = str_replace("<", "<" ,$str); $str = str_replace(">", ">" ,$str); $str = str_replace("&", "&" ,$str); $str = str_replace('"', """ ,$str); $str = str_replace("'", "'" ,$str); return $str; }
沒有留言:
張貼留言
‹
›
首頁
查看網路版
沒有留言:
張貼留言