开发者

PHP search and Replace query

开发者 https://www.devze.com 2023-02-04 06:19 出处:网络
i want to s开发者_如何学Goearch the symbols\\\"and replace it by\" How can i do that , i am using the following code that is not working

i want to s开发者_如何学Goearch the symbols \" and replace it by "

How can i do that , i am using the following code that is not working

$filenew = str_replace("\\"" , """, $filenew);


I think you are almost certainly looking for stripslashes.


Use:

$filenew = str_replace('\"' , '"', $filenew);

Working Example


$filenew = strtr($filenew, array('\"' => '"'));


Syntax highlighting should have given you a clue, but anyway, try one of these:

$filenew = str_replace('\\"' , '"', $filenew);

$filenew = str_replace("\\\"" , "\"", $filenew);

(If you look closely at the highlighting the SO code highlighter applies, you'll see that the comma is red, meaning you only have 2 parameters. Your escaping is wrong.)

0

精彩评论

暂无评论...
验证码 换一张
取 消