useCase useCase - 1 year ago 83
PHP Question

How can I define the DIRECTORY_SEPARATOR for both Windows and Linux platforms?

Now I create a small PHP Application, here I have problem for using file path, because in Windows use this type location

but in
Linux /www/app/index
so when I define the path using this
but when the application run in window machine it should be problem for this

So here I want to define the DIRECTORY_SEPARATOR both Windows and Linux platform.

Answer Source

PHP accepts both \ and / as valid path separators in all OS. So just use / in your code

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download