Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这个
preg_replace("/[^a-zA-Z0-9[:space:][:blank:]+-]/", "", $val);
加号转义
preg_replace("/[^a-zA-Z0-9[:space:][:blank:]\+-]/", "", $val);
当我想允许加号时,是否从 $val 中删除加号,如何正确转义加号?
我会建议:
echo preg_replace("/[^a-zA-Z0-9[:space:][:blank:]+\-]/", "", ':::test+++---:::');