The n linefeed in the php string is invalid and cannot be wrapped. For example, the following code :? Phpechohellon; echoworld ;? The linefeed n in the program will be directly output and cannot wrap the line correctly. the solution is to change the single quotes to the following code:
The code is as follows:
Echo 'hello \ n ';
Echo 'world ';
?>
The line break \ n in the program will be directly output and cannot wrap correctly. the solution is to change single quotes to double quotation marks:
The code is as follows:
Echo "hello \ n ";
Echo "world ";
?>
That's all! It is actually the difference between PHP double quotes and single quotes. Simply put, variables in double quotes can be parsed. single quotes are absolute strings.
Appendix: three methods for removing line breaks in PHP
The code is as follows:
// Line feed for different php systems
// The implementation of line feed varies with systems.
// In linux and unix/n
// For MAC/r
// Window is/r/n to reflect differences from linux
// The Implementation methods on different platforms are different.
// Php has three solutions
// 1. use str_replace to replace the line feed.
$ Str = str_replace (array ("/r/n", "/r", "/n"), "", $ str );
// 2. use regular expression replacement
$ Str = preg_replace ('// s */', '', $ str );
// 3. use the variables defined in php (recommended)
$ Str = str_replace (PHP_EOL, '', $ str );
?>
The pipeline code is as follows :? Php echo 'hello \ n'; echo 'world ';? The line break \ n in the program will be directly output and cannot wrap correctly. the solution is to change the single quotes...