Php's built-in variable 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. This variable is used to solve file delimiters. on windows, we use it as file delimiters, but on linux, people do not know this identifier, so we need to introduce the following php built-in variable: DIRECTORY_SEPARATOR for example: def php's built-in variable DIRECTORY_SEPARATOR is a command to display system separators. DIRECTORY_SEPARATOR is the internal constant of php, you can use it directly without any definition or inclusion. This variable is used to solve the File Separator. on windows, we habitually use \ as the file separator, but on linux, people do not know this identifier /, so we need to introduce the following php built-in variable: DIRECTORY_SEPARATOR
For example:
define('BLOGGUY.CN_ROOT', dirname(__FILE__)."/upload");
The above definition should be normal for debugging in windows, but when you upload the file to a linux server, you will find an error, and the error will appear on the file separator, therefore, the preceding statement can be rewritten as follows:
define('BLOGGUY.CN_ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR."upload");
In this way, the error will not occur. For example, define ('s _ root', dirname (_ FILE _) is written in discuz __). return to the problem itself. DIRECTORY_SEPARATOR is a php built-in command that returns the path separator related to the operating system, returns \ on windows, and returns/on linux or unix-like /, this is the difference. it is usually used when defining the path containing files or uploading and storing directories.
Take a look at the following example:
Const DIR_SEP = DIRECTORY_SEPARATOR; // path separation under win \ linux/
Private function _ construct (){
$ This-> _ options = array (
'Template _ dir' => 'templates'. self: DIR_SEP, // Directory of the template file
'Cache _ dir' => 'templates'. self: DIR_SEP. 'cache'. self: DIR_SEP, // cache file storage directory
'Auto _ update' => false, // whether to regenerate the cache when the template file is changed
'Cache _ lifetime' => 0, // cache lifecycle (minutes), 0 indicates permanent
'Suffix '=> '.html', // template file suffix
);
}