How to remove line breaks with PHP or JS

前端 未结 4 934
臣服心动
臣服心动 2021-01-14 20:31

I\'ve tried about everything to delete some extra \\n characters in a web application I\'m working with. I was hoping someone has encountered this issue before

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-14 21:20

    In php, use str_replace(array('\r','\n'), '', $string).

    I guess the problem is you also have \r's in your code (carriage returns, also displayed as newlines).

提交回复
热议问题