Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将 PHP 和 nginx 配置为仅显示特定 IP 地址的错误?
您可以先将 PHP 设置为根本不显示错误(display_errors = Offin php.ini),然后使用auto_prepend_filephp.ini 中的指令来包含此脚本:
display_errors = Off
php.ini
auto_prepend_file
<?php $allowed_ips = array('111.111.111.111', ...); if (in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) { ini_set('display_errors', '1'); }