在我的Symfony2项目中,我希望app_dev.php只能通过我的IP地址访问.就像在config.php中一样,我可以设置一个IP数组,这样每个人都无法访问这个文件.这也适用于app_dev.php吗?
cha*_*118 17
在app_dev.php中,您将找到以下代码
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'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
Run Code Online (Sandbox Code Playgroud)
您可以在此处设置要从中访问的IP地址.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('Your IP address', '127.0.0.1', 'fe80::1', '::1'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16216 次 |
| 最近记录: |