Home > Article > Backend Development > 正则过滤字符串中的正反斜杠解决方案
正则过滤字符串中的正反斜杠
<br />#源字符串<br />$str = "a/b\c\\d//e\/f";<br /><br />#正则表达式...<br /><br />#过滤后<br />$res = "abcdef";<br />
$str = "a/b\c\\d//e\/f";<br />echo preg_replace('/\W/', '', $str);abcdef