笔记wordpress获取访客真实ip修复使用cdn无法获取访客的真实ip把下面代码放到 wp-config.php 顶部位置。1 2 3 4 5 if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $list[0]; }