使路径在Linux和Windows上均有效 [英] Make a path work both on linux and Windows

查看:87
本文介绍了使路径在Linux和Windows上均有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定该路径:

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

在Linux和Windows上均可工作吗?

works both on linux and on windows?

推荐答案

在Linux中,路径分隔符为/.在Windows中,它是\/.因此,只要使用正斜杠就可以了.

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'

这篇关于使路径在Linux和Windows上均有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆