Home  >  Article  >  Backend Development  >  trim()没法去除的空格,chr(161)。用户提交文章总是出现

trim()没法去除的空格,chr(161)。用户提交文章总是出现

WBOY
WBOYOriginal
2016-06-13 11:09:42869browse

trim()无法去除的空格,chr(161)。用户提交文章总是出现。
用户POST提交字符串content内容写入数据库之前都会有trim去除每行的前后空格,可是看到的有的提交写入到数据库的内容还是有些段落前面有一小段空格。怎么都去除不掉。他不是\s也不是\n\r\0,用ord()函数查询他的值等于 161.但是如何去除开头的这个空。

------解决方案--------------------
trim($s, " \r\n".chr(161))

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn