PHP_EOLDIRECTORY_SEPARATOR constant description _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.