这个函数调用有什么问题? [英] What's wrong with this function call?
本文介绍了这个函数调用有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在php中调用 apache_request_headers()
获取 X-Forwarded-For
标题时,它会消隐任何和所有页面输出。我做错了什么?
When I call apache_request_headers()
in php to get the X-Forwarded-For
header, it blanks out any and all page output. What am I doing wrong?
$header = apache_request_headers();
$ip = $header["X-Forwarded-For"];
如果我注释掉这两行,它的工作正常,除了现在<$的明显问题c $ c> $ ip 未设置。
If I comment out those two lines it works just fine, except for the obvious issue that now $ip
isn't being set.
感谢您的帮助!
推荐答案
从手册中,可能就是这样:
From the manual, its probably this:
"This function is only supported when PHP is installed as an Apache module."
尝试
$_SERVER['HTTP_X_FORWARDED_FOR'];
如上面的评论所述。
这篇关于这个函数调用有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文