开发者

PHP Constant Question

开发者 https://www.devze.com 2023-04-03 10:11 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号