【发布时间】:2011-09-14 09:06:55
【问题描述】:
可能重复:
quick function to replace ' with \' in php
Is there a PHP function that only adds slashes to double quotes NOT single quotes
例如:
$one = 'put "returns" between "paragraphs"';
$two = '"linebreak" add 2 spaces "at end"';
如何将其转换为:
$one = 'put \"returns\" between \"paragraphs\"';
$two = '\"linebreak\" add 2 spaces \"at end\"';
【问题讨论】:
-
尝试在谷歌输入你的问题标题
-
基本问题...下次试试谷歌。现在,看看PHP的addslashes方法
-
addslashes不正确,会替换更多。因此,所有因此而渴望关闭的人(迄今为止唯一建议的重复项)可能搜索得太快了 :)
标签: php html escaping backslash