Different operating systems have different symbols. how can we write PHP code so that we can port different operating systems? Different operating systems have different symbols. how can we write PHP code so that we can port different operating systems?
1. DIRETORY_SEPORATOR default file path separator of the current operating system
$ Unixpath = "/var/test/a. php": // you must use "/" as the file path separator in unix.
$ Windwospath1 = "C: \ www \ test \ aa. php ": // in windows," \ "is used as the file path separator by default, but" \ "must be escaped.
$ Windowspath2 = "www/test/a. php" // this type is recommended.
For program portability, we recommend that you use "/" for file paths, or you can use DIRETORY_SEPORATOR.
2. linefeed of the current PHP_EOL system
\ R \ n in windows indicates a line break
In unix, \ r indicates a line break.