为什么要对字符串编码? 某些字符串中包含html标签,不编码,页面输出就乱了. PHP下怎么对字符串编码? htmlentities vs htmlspecialchars htmlentities 与htmlspecialchar 区别: htmlentities is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character