what is the difference between `/` and `\` in php

前端 未结 4 1961
青春惊慌失措
青春惊慌失措 2020-12-18 13:46

I am trying to understand examples in PSR-0, but to no avail. I know that \\ is directory separator (at least in my windows OS), and in my humble opinion, it ca

4条回答
  •  萌比男神i
    2020-12-18 14:26

    \ is used as a delimiter for namespaces and / is used as the directory separator for files. The example is based on a unix system.

    Although \ is used as a directory separator on you windows using / will work as well (e.g. for loading files). But if you would like the correct directory separator on all systems you can always use the system specific constant DIRECTORY_SEPARATOR.

提交回复
热议问题