开发者

What's wrong with this function call?

When I call apache_request_headers() in php to get the X-Forwarded-For header, it blanks ou开发者_高级运维t any and all page output. What am I doing wrong?

$header = apache_request_headers(); 
$ip = $header["X-Forwarded-For"];

If I comment out those two lines it works just fine, except for the obvious issue that now $ip isn't being set.

Thanks for your help!


From the manual, its probably this:

"This function is only supported when PHP is installed as an Apache module."

Try

 $_SERVER['HTTP_X_FORWARDED_FOR'];

As mentioned in the comments above.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜