Role of DIRECTORY_SEPARATOR. DIRECTORY_SEPARATOR is an internal constant of php. it is used to display system separator commands and can be directly used without any definition or inclusion. In windows, the path separator is (of course, some DIRECTORY_SEPARATOR is the internal constant of php, which is used to display the system separator command and can be directly used without any definition or inclusion.
In windows, the path separator is (of course, it can also 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 errors may occur when uploaded to the linux server. So php introduced the DIRECTORY_SEPARATOR variable, which can be rewritten:
Define (ROOT, dirname (_ FILE _). DIRECTORY_SEPARATOR. "upload ");
DIRECTORY_SEPARATOR is a php built-in command that returns path delimiters related to the operating system. it is returned on windows, while/is returned on linux or unix-like, it is usually used when defining the path containing files or uploading and storing directories.
For example:
View plaincopy to clipboardprint?
Const DIR_SEP = DIRECTORY_SEPARATOR; // path separation in Windows/
Private function _ construct ()
{
$ This-> _ options = array (
Template_dir => templates. self: DIR_SEP, // directory where the template file is located
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
);
}
Bytes. In windows, the path separator is (of course/in some...