sanders sanders - 3 months ago 6
Linux Question

Make a path work both on linux and Windows

How can I make sure that this path:

new Zend_Log_Writer_Stream(APPLICATION_PATH . '\logs\app.log')


works both on linux and on windows?

Answer

In Linux, the path separator is /. In Windows, it is either \ or /. So just use forward slashes and you will be fine.

APPLICATION_PATH . '/logs/app.log'
Comments