DIRECTORY_SEPARATOR is a command for displaying system delimiters. DIRECTORY_SEPARATOR is an internal constant of PHP and can be directly used without any definition or inclusion.
DIRECTORY_SEPARATOR is a command for displaying system delimiters. DIRECTORY_SEPARATOR is an internal constant of PHP 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), and 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 saving the specified Upload files on the debugging machine is: define ('root', dirname (_ FILE __). "upload"). local debugging is normal, but errors may occur when uploading data to the linux server.
This problem lies in the file separator, which is habitually used as a file separator on windows, but on linux, people do not know this identifier, but they only know /, so we need to introduce the following php built-in variable: DIRECTORY_SEPARATOR.
The preceding statement can be rewritten as follows:
Define ('root', dirname (_ FILE _). DIRECTORY_SEPARATOR. "upload ");
In this way, the error will not occur.
For example, define ('s _ root', dirname (_ FILE _). DIRECTORY_SEPARATOR) is written in discuz );
Back to the problem itself, DIRECTORY_SEPARATOR is a php built-in command that returns the path separator related to the operating system, which is returned on windows and/on linux or unix-like /, this is the difference. it is usually used when defining the path containing files or uploading and storing directories.