Directory_separator is the internal constant of PHP, used to display the system separator commands, without any definition or inclusion to be used directly.
In Windows under the path separator is \ (of course/on the part of the system can also be normal operation), on Linux, the path of the separator is/, which led to a problem, such as the development of the machine is Windows, there is a picture upload program, debug machine designated upload file save directory is:
Define (ROOT, DirName (__file__). " /upload ");
Debugging locally is normal, but when uploaded to a Linux server, you will find an error. So PHP introduced the directory_separator variable, you can rewrite the above to:
Define (ROOT, DirName (__file__). Directory_separator. " Upload ");
Directory_separator is a PHP built-in command that returns the path separator associated with the operating system, returned on Windows, and returns on Linux or Unix-like, that's the difference. It is usually used when defining the include file path or uploading the save directory.
For example:
View Plaincopy to Clipboardprint?
Const DIR_SEP = directory_separator;//path split win under Linux/
Private Function __construct ()
{
$this->_options = Array (
Template_dir => templates. Self::D ir_sep,//template file directory
Cache_dir => templates. Self::D ir_sep. Cache. Self::D ir_sep,//cache file storage Directory
Auto_update => false,//rebuild cache when template files are changed
Cache_lifetime => 0,//Cache life cycle (minutes), 0 for permanent
Suffix =>. html//template file suffix
);
}