PHP:如何替换引号

时间:2010-05-16 12:58:38

标签: php

我正在使用它,但它不起作用:

$replaced = str_replace(''', '"', $text);

任何帮助都将不胜感激。

3 个答案:

答案 0 :(得分:9)

试试这个:

$replaced = str_replace('\'', '"', $text);

OR

$replaced = str_replace("'", '"', $text);

答案 1 :(得分:0)

$replaced = str_replace('\'', '"', $text);

答案 2 :(得分:-3)

str_replace(array(" ' ", " \" ", " " "), " ", htmlspecialchars($variable ) );