The role of "PHP" Directory_separator

Source: Internet
Author: User

Directory_separator is the internal constant of PHP, which is used to display the system delimiter commands without any definition or inclusion.

The path delimiter in Windows is/(of course, it works on some systems), the delimiter on Linux is/, which leads to a problem, such as the development machine is windows, there is a picture upload program, the debug machine on the specified upload file save directory is:

Define (' ROOT ', DirName (__file__). " /upload ");

Debugging on-premises is normal, but when uploading to a Linux server, you will see an error. So PHP introduced the directory_separator variable, you can rewrite the above syntax:

Define (' ROOT ', DirName (__file__). Directory_separator. " Upload ");

Directory_separator is a PHP built-in command that returns the path delimiter associated with the operating system, returning on Windows/, and returning on Linux or Unix--that's the difference, This is usually used when you define a file path or upload a directory to save it.

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.