For example, the following code:
Copy Code code as follows:
<?php
Echo ' hello\n ';
echo ' World ';
?>
The newline character in the program is output directly, and the line cannot be wrapped correctly, and the solution is to change the single quotation mark into double quotation marks:
Copy Code code as follows:
<?php
echo "hello\n";
echo "World";
?>
That's it! In fact, PHP's double quotes and single quotes, the difference between the simple generalization of double quotes in the variable can be resolved, single quotes is an absolute string.
With: Php to remove line wrapping three method code
Copy Code code as follows:
<?php
Change lines for different systems in PHP
The implementation of line wrapping between different systems is not the same
Linux with/N in Unix
MAC with/R
windows in order to reflect the difference with Linux is/r/n
So it's not the same way to implement the different platforms.
PHP has three ways to solve
1. Use Str_replace to replace line wrapping
$str = Str_replace (Array ("/r/n", "/R", "N"), "", $str);
2, the use of regular replacement
$str = preg_replace ('//s*/', ', ', $str);
3. Use PHP to define a good variable (recommended)
$str = Str_replace (Php_eol, ', $str);
?>