【发布时间】:2017-07-16 07:34:17
【问题描述】:
我试图打印超全局变量$_SERVER['HTTP_X_FORWARDED_FOR'] 以测试我的网站的代理阻止程序。当我打开文件时,服务器返回此错误:
注意:未定义索引:/Applications/XAMPP/xamppfiles/htdocs/test/test.php 第 2 行中的 HTTP_X_FORWARDED_FOR
这是文件里面的内容:
<?php
echo $_SERVER['HTTP_X_FORWARDED_FOR'];
?>
有什么问题?那个变量是不可打印的吗?好像没有定义变量时出现的错误。
提前致谢。
【问题讨论】:
-
来自PHP doc:
You may or may not find any of the following elements in $_SERVER. Note that few, if any, of these will be available (or indeed have any meaning) if running PHP on the command line.
标签: php