Make a path work both on linux and Windows

后端 未结 4 2281
天命终不由人
天命终不由人 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:57

    if you want to communicate two or more app of your site, this trick will serve you much

    $ Document_root = realpath ( \ filter_input ( INPUT_SERVER , ' DOCUMENT_ROOT '));
    

    this is to convert the route you back real path and then just have to navigate between directories with the DIRECTORY_SEPARATOR without worrying about the operating system installed on your machine or web server

提交回复
热议问题