How to remove carriage returns from output of string?

前端 未结 7 947
无人及你
无人及你 2020-12-08 04:30

I am using wordpress as a CMS and trying to allow user fields to be input to populate the info windows in a Google Map script. I am using this to select the id and pull in

7条回答
  •  我在风中等你
    2020-12-08 04:49

    I always use this to get rid of pesky carriage returns:

    $string = str_replace("\r\n", "\n", $string); // windows -> unix
    $string = str_replace("\r", "\n", $string);   // remaining -> unix
    

提交回复
热议问题