sanders sanders - 1 year ago 86
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 Source

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'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download