server path / vs \
In some documentation, I have gotten the instructions to write SERVER_PATH\theme\
When I check _SERVER["DOCUMENT_ROOT"] from php info, it's /storage/content/75/113475/frilansbyran.se/public_html
this renders of course /storage/content/75/113475/frilansbyran.se/public_html\theme\
this l开发者_JAVA技巧ooks really weird to me what's the difference anyway which should I use? (unix-server)
Using backslashes is typically the windows way of paths, eg:
C:\Windows\System32
Forward slashes are usually used in Unix systems ala:
/usr/home/jdoe
If you are using a Unix-server I would stick to the forward slashes (/'s), though many times in in practice the system is smart enough to use either interchangeably
Path separator in Unix is /
. The backslash \
is used to escape some special characters (incl. space) in the directory and file names.
The backslash \
is used as a path separator in the Windows world. It is possible, that 'some' documentation uses it.
If you are on Unix, use slash /
only.
In *nix, forward slash [/
] is used as the directory separator, so I would use that.
Back slashes [\
] are used as directory separators on Windows systems.
To add to what others have said:
in URLs on the web, the Unix-style forward-slash
/
is always used; a backslash won't work in most situations.in Windows filepaths, the forward-slash is an acceptable alternative to the backslash, so although it's not the normal way of writing it,
C:/Foo/Bar
will work.
So if in doubt, use the forward slash.
精彩评论