You can use PHP_EOL instead in PHP to improve the source code level portability of the code
Unix series (recommended learning:PHP programming from entry to proficiency)
\n
For Windows series
\r\n
For mac
\r
For example:
<?php echo PHP_EOL; //windows平台相当于 echo "\r\n"; //unix\linux平台相当于 echo "\n"; //mac平台相当于 echo "\r"; ?>
Recommended related articles:
1.How to use line breaks in PHP? (Code sample)
Related video recommendations:
1.Dugu Jiujian (4)_PHP video tutorial
The above is the detailed content of How to write line break in php. For more information, please follow other related articles on the PHP Chinese website!