php The solution for r n not to wrap: First open the PHP file where r n does not wrap; then change the single quotes in the output code to double quotes to achieve normal line wrapping.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
\nNewline in php string The solution to the problem of invalid characters and unable to wrap lines
For example, the following code:
The code is as follows:
<?php echo 'hello\n'; echo 'world'; ?>
The newline character \n in the program will be output directly, The line break cannot be correct. The solution is to change the single quotes to double quotes:
The code is as follows:
<?php echo "hello\n"; echo "world"; ?>
That’s it! In fact, it is the difference between double quotes and single quotes in PHP. In a simple summary, variables in double quotes can be parsed, and single quotes are absolute strings.
[Recommended study: "PHP Video Tutorial"]
Note:
php Line breaks in different systems
Among different systems The implementation of line breaks is different
/n is used in linux and unix
MAC uses /r
window In order to reflect the difference from linux, it is /r/n
So the implementation methods are different on different platforms
The above is the detailed content of What to do if php r n does not wrap?. For more information, please follow other related articles on the PHP Chinese website!