Welcome to the Linux community forum and interact with 2 million technicians to enter different operating systems with different symbols. How can we write PHP code so that we can port it in different operating systems? 1. DIRETORY_SEPORATOR default file path separator for the current operating system $ unixpathvartesta. php: Required for unix systems
Welcome to the Linux community forum and interact with 2 million technical staff> entering different operating systems has different symbols. How can we write PHP code so that we can port it in different operating systems? 1. DIRETORY_SEPORATOR the default file path separator $ unixpath = "/var/test/a. php": // required for unix systems"
Welcome to the Linux community forum and interact with 2 million technicians>
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.