When do I use PHP_EOL instead of \n and vice-versa ? Ajax/Jquery client problem

后端 未结 5 682
渐次进展
渐次进展 2020-12-01 08:26

I have a php parser that split a given string by line-breaks, doing something like this:

$lines = explode(PHP_EOL,$content);

The parser wor

5条回答
  •  情书的邮戳
    2020-12-01 08:35

    PHP_EOL is the line ending used by the server PHP is running on. User submitted content will probably have line ending in whatever format they use. However, instead of exploding on newlines, just using the file() function, it does exactly what you are after.

提交回复
热议问题