Home >Backend Development >PHP Tutorial > php的preg_match将验证字符中的#算作注释了

php的preg_match将验证字符中的#算作注释了

WBOY
WBOYOriginal
2016-06-13 12:32:50875browse

php的preg_match将验证字符中的#当成注释了
php的preg_match将验证字符中的#当成注释了。要验证的字符中包含#,会将#后面的内容全部当成注释处理,导致验证失败。这是php的bug吧。

这其实是个误会。preg_match没问题。在ajax请求时,参数带#,则会将后面的参数全过滤掉,需要给参数加上url_encode()就OK了。

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