我的代碼:當我嘗試插入ip2long整數,錯誤整數被插入到表
$ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'][0]); // Gives an IP address string. Example: "176.10.99.207"
$ipL = ip2long($ip); // An integer, which for this example would be 2953470927.
if($stmt_insert_ip = $ip_link->prepare("INSERT INTO dataTable(ip,datetime) VALUES(?,?)")){
$stmt_insert_ip->bind_param('is',$ipL,date("Y-m-d H:i:s"));
}
但是,當我檢查我的MySQL表中,ip
列下的新插入的值是2147483647,這是「127.255.255.255」。
當我運行echo($ipL);
,不過,我得到2953470927.
什麼H-E-雙曲棍球棒是怎麼回事?