我们都知道,在javascript中,字符串写在单引号或者双引号之中.因为这种要求,我们有些时候一些需要的字符串不能够被javascript解析,如下: "We are "Human",we are smart!" 上述字符串会被截断,要解决上述问题,我们可以使用反斜杠(\)来转义字符串中的双引号,如下 "We are \"Human\",we are smart!" 反斜杠是一个转义字符,转义字符将特殊字符转换为字符串字符:…
为什么要对字符串编码? 某些字符串中包含html标签,不编码,页面输出就乱了. PHP下怎么对字符串编码? htmlentities vs htmlspecialchars htmlentities 与htmlspecialchar 区别: htmlentities is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character…