很多时候记录日志需要换行。不建议使用\r\n,因为:
在windows中\r\n是换行
在Mac中\r是换行
在Liunx中\n是换行
但是PHP提供了一个常量来匹配不同的操作系统,即:
file_put_contents("log.txt", "Hello world everyone.".PHP_EOL, FILE_APPEND);
很多时候记录日志需要换行。不建议使用\r\n,因为:
在windows中\r\n是换行
在Mac中\r是换行
在Liunx中\n是换行
但是PHP提供了一个常量来匹配不同的操作系统,即:
file_put_contents("log.txt", "Hello world everyone.".PHP_EOL, FILE_APPEND);
相关文章: