replace \n with actual new line character code

前端 未结 5 2145
孤街浪徒
孤街浪徒 2021-02-19 03:32

I\'m pulling content from a DB that has been sanitized using mysql_real_escape_string. Accordingly the new line characters now appear as \"\\n\". The issue is that this content

5条回答
  •  悲哀的现实
    2021-02-19 04:21

    why not ...

    echo str_replace('\\n', PHP_EOL, "few lines\nof text here,\nblah, blah! etc!");
    

提交回复
热议问题