取得用戶的IP位址,把多種取得用戶IP的方法整合再一起。
<?php function GetIP(){ if(!empty($_SERVER["HTTP_CLIENT_IP"])){ $cip = $_SERVER["HTTP_CLIENT_IP"]; }elseif(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){ $cip = $_SERVER["HTTP_X_FORWARDED_FOR"]; }elseif(!empty($_SERVER["REMOTE_ADDR"])){ $cip = $_SERVER["REMOTE_ADDR"]; }else{ $cip = "無法取得IP位址!"; } return $cip; } ?>
酷米 © All Rights Reserved.