【发布时间】:2015-03-09 01:37:41
【问题描述】:
我的代码:
$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-Double 曲棍球棒是怎么回事?
【问题讨论】: