Skip to content
Advertisement

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 C:SomeLocationindex 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.

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement