如何配置 PHP 和 nginx 以仅显示特定 IP 地址的错误?
你可以
先将PHP设置为完全不显示错误(display_errors = Off
在php.ini
中),然后在php中使用auto_prepend_file
指令.ini以包含以下脚本:
<?php
$allowed_ips = array('111.111.111.111', ...);
if (in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) {
ini_set('display_errors', '1');
}