dourang8305
2015-07-29 13:29
浏览 35
已采纳

Symfony 2:app_dev.php中@运算符的用途

The default code that prevents access to debug front controller on production server is:

if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

So the question is: Why would it be needed to supress warnings from @$_SERVER['REMOTE_ADDR']? The errors from other $_SERVER variables aren't supressed though.

图片转代码服务由CSDN问答提供 功能建议

阻止访问生产服务器上的调试前端控制器的默认代码为:</ p> < pre> if(isset($ _ SERVER ['HTTP_CLIENT_IP']) || isset($ _ SERVER ['HTTP_X_FORWARDED_FOR']) ||!(in_array(@ $ _ SERVER ['REMOTE_ADDR'],数组( '127.0.0.1','fe80 :: 1',':: 1'))|| php_sapi_name()==='cli-server') ){ header('HTTP / 1.0 403 Forbidden') ; exit('不允许访问此文件。请检查'.basename(__ FILE__)。'以获取更多信息。'); } </ code> </ pre>

所以问题是:为什么需要从@ $ _ SERVER ['REMOTE_ADDR']中抑制警告? 但是其他$ _SERVER变量的错误并没有被抑制。</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题