views:

43

answers:

4

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 ofcourse /storage/content/75/113475/frilansbyran.se/public_html\theme\

this looks really weird to me what's the difference anyway wich should i use? (unix-server)

+1  A: 

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.

eumiro
+1  A: 

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.

pferate
+1  A: 

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

Josh W.
When I say system I mean using the wrong type of path within PHP or IIS (if on Windows), if you're at a unix shell the windows backslashes won't behave as you intend
Josh W.
+1  A: 

To add to what others have said:

  1. in URLs on the web, the Unix-style forward-slash / is always used; a backslash won't work in most situations.

  2. 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.

bobince