Description of the PHP_EOLDIRECTORY_SEPARATOR constant. Description of the PHP_EOLDIRECTORY_SEPARATOR constant PHP_EOL is a linefeed constant defined in the php system source code. Why is there such a constant? Because in different systems, the description of the wrap PHP_EOL DIRECTORY_SEPARATOR constant
PHP_EOL is a constant of linefeed defined in the php system source code.
Why is there such a constant?
Because in different systems, line breaks are different. For example:
\ N for unix
Windows \ r \ n
Mac \ r
Php defines PHP_EOL. this constant will change based on the platform to improve the source code portability.
Similar to common
DIRECTORY_SEPARATOR
Php's built-in constant DIRECTORY_SEPARATOR is a command for displaying system delimiters and can be directly used without any definition or inclusion.
As we all know, in windows, the path separator is \ (of course/can run normally on some systems). In linux, the path separator is/, which leads to a problem, for example, if the development machine is windows and there is an image upload program, the directory for storing the specified Upload files on the debugging machine is:
define('ROOT', dirname(__FILE__)."\upload");
Local debugging is normal, but an error occurs after being uploaded to the linux server. Therefore, the code above is written as follows:
Define ('root', dirname (_ FILE _). DIRECTORY_SEPARATOR. "upload ");
Tip: you can use the get_defined_constants () function to obtain all PHP constants. for example:
Articles you may be interested in
- Php built-in variable DIRECTORY_SEPARATOR parsing
- Php $ GLOBALS Super global variable analysis
- Summary of system constants in the Action Controller of thinkphp
- Summary of common system variables in Thinkphp templates
- Use php functions in the smarty template and how to use multiple functions for a variable in the smarty Template
- Five major php operating modes: CGI, FAST-CGI, CLI, ISAPI, and APACHE
- Common PHP variable judgment functions
- Constant analysis in PHP
Description of the http://www.bkjia.com/PHPjc/987399.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/987399.htmlTechArticlePHP_EOL DIRECTORY_SEPARATOR constant PHP_EOL is a linefeed constant defined in the php system source code. Why is there such a constant? Because in different systems, line feed...