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.
echo preg_quote("aaa<bbb");
应该写:
aaa\<bbb
但我得到:
aaa\
这是制造问题的唯一标志。
如果你想在浏览器中显示它是什么,你可以将它包装在<pre>标签中。
<pre>
echo '<pre>'.preg_quote("aaa<bbb").'</pre>';
或者您可以使用 htmlspecialchars 来转义<.
<
echo htmlspecialchars(preg_quote("aaa<bbb"));