quotemeta
<?php
$str = "Hello world. (can you hear me?)";
echo quotemeta($str);
//输出 Hello world\. \(can you hear me\?\)
?>
在字符串中某些预定义的字符前添加反斜杠