Home >Backend Development >PHP Tutorial >正则过滤字符串,该如何解决

正则过滤字符串,该如何解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:25:45837browse

正则过滤字符串

<br /><?php<br />//中文编码包含UTF-8,GBK<br />$str = "新_建&文\件,夹 abd";<br />//获取结果<br />$res = "新建文件夹abd";<br />//包含非法字符:<br />$out[0] = "_";<br />$out[1] = "&";<br />$out[2] = "\";<br />$out[3] = " ";<br />$out[4] = ",";<br />?><br />

正则 PHP
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