我得到這個:preg_replace自動添加< and >,但它很奇怪?
$_response_body = preg_replace("</body>","<script>alert('test');</script><br /></body>",$_response_body);
它應該寫:
<script>alert('test');</script><br />
</body>
但事實並非如此。如果我刪除小於號和偉大 - 比符號所以說
<<script>alert('test');</script><br /></body>>
正如你所看到的,它增加了一個額外的<和> ..:
script>alert('test');</script
然後將其寫入回報它將返回:
<script>alert('test');</script<br /></body>>
有人知道爲什麼會發生這種情況?
使用'str_replace()'而不是 – 2013-02-24 20:18:48