开发者

PHP directory separators & inconsistencies

I run PHP on my Windows 7 dev box. I've noticed that paths produced from the $_SERVER array always use forward slashes, whereas other sources such as __FILE__ use back slashes.

Now, I'm assuming that the $_SERVER derived paths are forward slashed bec开发者_如何转开发ause they're generated by the Apache binaries, whereas __FILE__, et al., produce back slashes because they're hitting the OS for path info.

My question is, is there any other rhyme or reason? I'm not a fan of DIRECTORY_SEPARATOR and am currently just running $path = strtr($path, '\\', '/'); on everything. I just don't want to be doing it for nothing, or not doing it when I should.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜