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.
我需要一些有效的方法来转义字符串中的所有特殊字符。例如,我的字符串
I need some effective way(1) [2] for $10 + e
应转换为
I need some effective way\(1\) \[2\] for \$10 \+ e
谢谢
尝试quotemeta:
quotemeta
http://uk3.php.net/manual/en/function.quotemeta.php