str_replace不起作用

时间:2012-07-02 07:14:52

标签: php str-replace

这是我的字符串:

$a = "RSS
here: 
Your result: 3 points form 50 example.";

如何从此字符串中删除“RSS here:”?

我的尝试:

$result = str_replace("RSS
here: 
Your result: 3 points form 50 example.", " " ,$a);
echo $result;

2 个答案:

答案 0 :(得分:1)

\r\n使用carriage return + line feed,例如新行:

$a = "RSS
here: 
Your result: 3 points form 50 example.";

$result = str_replace("RSS\r\nhere:", "" ,$a);
echo $result;

<强>结果:

Your result: 3 points form 50 example.

答案 1 :(得分:0)

如果你的RSS中没有特殊字符:这应该是

$result = str_replace("RSS here:", "", $a);