how to remove new lines and returns from php string?

后端 未结 10 1103
孤城傲影
孤城傲影 2020-12-24 01:06

A php variable contains the following string:

text

text2

  • item1
  • item2
10条回答
  •  天涯浪人
    2020-12-24 01:50

    This should be like

    str_replace("\n", '', $str);
    str_replace("\r", '', $str);
    str_replace("\r\n", '', $str);
    

提交回复
热议问题