Home  >  Article  >  Backend Development  >  php $_SERVER windows系统与linux系统下的区别说明_PHP

php $_SERVER windows系统与linux系统下的区别说明_PHP

WBOY
WBOYOriginal
2016-06-01 11:55:55780browse

这是我在做企业站的过程中发现的一些区别:(仅供参考)

一、$_SERVER['SERVER_NAME']  在windows系统下,末尾是有 / 的,linux下没有/ 。 可用以下方法处理

 1、不论是那种系统直接全部加上 / 然后在进行替换 ,切记 ,应如此替换 str_replace('\\', '/', $fileUrl); 才可以。

 2、判断是那种操作系统,使用PHP_OS,然后进行字符截取进行判断。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn