PHP Constant Question
What is the
DIRECTORY_SEPARATOR
constant contain?
I can't开发者_如何学运维 find anything on google explaining this but its used in my OOP book.
It is the separator that link folder in a path like "/" in :
here/is/my/path
The separator depends on which OS you are running your website.
On windows, this is "\" :
my\path\to\folder
On Unix it's "/"
Either '/' or '\' depending on your OS. Use it when specifying paths to make code more portable between Unix-y systems and Windows.
It's sort of on the tin.
When I run
var_dump(DIRECTORY_SEPARATOR);
I get (on my Linux/Ubuntu box)
string(1) "/"
(A forward slash). This is the separator string that applies to file paths on the OS your server is running on. It will most probably be a \
(backslash) on Windows systems.
精彩评论