How to replace “\” using str_replace() in PHP?

后端 未结 5 1112
暗喜
暗喜 2020-12-11 15:23

I would like to remove all back slashes from strings on my site. I do not wish to use strip_slashes(), because I want to keep forward slashes.

This is the code I am

5条回答
  •  时光取名叫无心
    2020-12-11 15:53

    The backslash is actually escaping the closing quote in your string.

    Try echo str_replace("\\","","it\'s Tuesday!");

提交回复
热议问题