Today, I am reading a demo of yaf of laruence. In the entry FILE, the author has the following definition: define (DS,); define (APP_PATH, dirname (_ FILE __). DS .... DS. application. DS); the author means that DS is defined as the path separator. I suddenly remember that a constant in PHP defines the path separator, And that constant is an adaptive platform.
Today, I am reading a demo of yaf of laruence. In the entry FILE, the author has a definition: define (DS,/); define (APP_PATH, dirname (_ FILE __). DS .... DS. application. DS); the author means that DS is defined as the path separator. I suddenly remember that a constant in PHP defines the path separator, And that constant is an adaptive platform.
Today, I am reading a demo of yaf of laruence. In the entry file, the author has the following definition:
define("DS", '/');define("APP_PATH", dirname(__FILE__).DS.'..'.DS.'application'.DS);
The author means "DS" is defined as the path separator. I suddenly remember that a constant in PHP defines the path separator, And that constant is an adaptive platform. The author does not need to define this definition at all, because if it is really true, we have to change it under win.
But I suddenly forgot how to spell the constant, and I am sorry to check the manual. Swollen? You can only print all the pre-defined constants using "get_defined_constants ()" and find them by yourself:
print '';print_r(get_defined_constants());print '
';
The get_defined_constants function returns all predefined constants to an array.
Print it out. Hey, there are so many! What I want is this:
[DIRECTORY_SEPARATOR] => \[PATH_SEPARATOR] => ;
DIRECTORY_SEPARATOR, which is defined as "\" under windows;
The code can be changed:
define("DS", DIRECTORY_SEPARATOR);define("APP_PATH", dirname(__FILE__).DS.'..'.DS.'application'.DS);
As the name implies, DIRECTORY_SEPARATOR is the "directory separator" and directory separator.