Make a path work both on linux and Windows

后端 未结 4 2280
天命终不由人
天命终不由人 2020-11-30 03:18

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

4条回答
  •  孤街浪徒
    2020-11-30 03:53

    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'
    

提交回复
热议问题