htmlspecialchars();
htmlentities();
以上两个均能实现转义,建议使用:
htmlspecialchars(htmlspecialchars($a));
进行双重转义。