I’ve needed it in JavaScript in the past and now I need it in PHP. Escape all those pesky special XML characters like so
function XmlEncode($content)
{
$trans = array("&" => "&", "<" => "<", ">" => ">", "'" => "'",
"\"" => """, "’" => "'");
return strtr($content, $trans);
}
No comments:
Post a Comment