Home >Backend Development >PHP Tutorial > 循环出$_SERVER,出现一大堆变量未定义。解决办法

循环出$_SERVER,出现一大堆变量未定义。解决办法

WBOY
WBOYOriginal
2016-06-13 13:22:32925browse

循环出$_SERVER,出现一大堆变量未定义。

foreach($_SERVER as $i){
echo $_SERVER[$i] . '
';
}

在页面上面加上了error_reporting(E_ALL & ~E_NOTICE);
它就什么都不显示了。

------解决方案--------------------

PHP code


foreach($_SERVER as $i){
    echo $i . '<br>';
}
<br><font color="#e78608">------解决方案--------------------</font><br>
或者  <br>
PHP code

foreach($_SERVER as $k => $i){
    echo $_SERVER[$k] . '<br>';
} <div class="clear">
                 
              
              
        
            </div>
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