“不直接访问Superglobal $ _SERVER阵列"在Netbeans 7.4 for PHP上 [英] "Do not Access Superglobal $_SERVER Array Directly" on Netbeans 7.4 for PHP
问题描述
是的,张贴了类似的问题并正确回答了. 警告执行不能直接访问Superglobal $ _POST阵列"在适用于PHP的Netbeans 7.4上
Yes, a similar question was posted and answered correctly. Warning "Do not Access Superglobal $_POST Array Directly" on Netbeans 7.4 for PHP
该帖子很有帮助.但这并不能解决我的问题.
That post was helpful. but it did not resolve my problem.
我的浏览器没有任何输出.
I am not getting any OUTPUT in my browser.
我应用了所有与$ _SERVER交换$ _POST的选项.
I applied all of the options exchanging $_POST with $_SERVER.
我的原始代码:
$user_ip = $_SERVER[ 'REMOTE ADDR'];
我的代码修改了其他问题/答案所建议的几种方式
My code modified several ways as the other question/ answer suggests
user_ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
user_ip = filter_input_array(INPUT_SERVER, 'REMOTE_ADDR');
仍然没有出场
背景.
在我阅读这些教程时,我将代码附加到index.php中的代码之后.
I am appending code after code in my index.php as I go thru these tutorials.
我一直在注释掉之前的代码.
I keep commenting out the previous code.
我错过了几条评论,那时我实际上已经输出了
I missed a few comments and at that point I actually DID HAVE OUTPUT
::1
我期望的输出是
127,0,0,1
当我评论了上一教程中的所有代码时 我不再有任何输出.
When I commented the all of the code from the previous tutorial I no longer get any output.
我将通过一个非常好的教程,但是他正在使用xampp. 我在Mac上并安装了放大器. 不知道这是否重要.
I am going thru a tutorial which is very good but he is using xampp. I am on a Mac and installed amp. Don't know if that matters.
如果要查看,请导航至 thenewboston.com 讲解 p 第33课 http://thenewboston.org/watch.php?cat=11&=number= 33 一分钟左右.
If you want to take a look, navigate to thenewboston.com Tutorials Php Lesson 33 http://thenewboston.org/watch.php?cat=11&number=33 First minute or so in.
推荐答案
当PHP基于FastCGI时, filter_input(INPUT_SERVER,… 和 filter_input_array(INPUT_SERVER ... 不要返回任何结果!
When PHP is FastCGI based, filter_input(INPUT_SERVER,… and filter_input_array(INPUT_SERVER… don't return any results!
请参见关于filter_input的PHP手动条目,请特别注意该注释由安东尼·帕森斯
这篇关于“不直接访问Superglobal $ _SERVER阵列"在Netbeans 7.4 for PHP上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!