事件 'start_time' 被错误地存储到 mysql 数据库中。
错误存储的事件
https://graph.facebook.com/112797205532177 - 存储为 2012-10-12 19:00:00
正确的是 2012-10-13
{
"id": "112797205532177",
"owner": {
"name": "MUST...NOT...KILL",
"category": "Musician/band",
"id": "108837005801452"
},
"name": "METAL MEOWLISHA",
"description": "W/ Brutailty",
"start_time": "2012-10-13",
"location": "The brass mug",
"venue": {
"id": "151496721577181"
},
"privacy": "OPEN",
"updated_time": "2012-07-27T21:20:20+0000"
}
https://graph.facebook.com/278345158937377 - 存储为 2012-11-18 18:00:00
正确的是 2012-11-19
{
"id": "280381075399709",
"owner": {
"name": "Lamb of God",
"category": "Musician/band",
"id": "9008741434"
},
"name": "Lamb of God On Tour",
"description": "Wed/Oct-31\tLos Angeles, CA @ TBA\t",
"start_time": "2012-10-31",
"privacy": "OPEN",
"updated_time": "2012-09-05T21:37:29+0000"
}
我一直在网上搜索解决方案。没有运气
目标是存储确切的字段“start_time”而不进行转换。我的代码中没有转换。我认为这与php设置有关
编辑:添加了从图形 api 返回的结果,这是我的插入字符串(在 codeigniter
$eventdata = array(
'artists_name'=>$artists,
'event_status'=>$event_stat,
'formatted_datetime'=>$formatted_datetime,
'formatted_location'=>$formatted_location,
'event_id'=>$event_id,
'venue_name'=>$venue_name,
'venue_city'=>$vcity,
'venue_region'=>$vstate,
'venue_country'=>$vcountry,
'venue_lat'=>$vlat,
'venue_long'=>$vlong,
'date_time'=>$date_time,
'rsvp_url'=>$rsvp_url,
'ticket_url'=>$ticket_url,
'updated'=>$updated);
$eventinsert = $this->db->insert_string('newEvents',$eventdata);
$this->db->query($eventinsert);
谢谢
编辑这是完整的 php 文件
include 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
));
$check = $facebook->api('278345158937377');
print_r ($check['start_time']);
?>
到目前为止,我可以剥离一切。我觉得奇怪的是字符串结果会在显示之前自动转换。
facebook 网站上的图表和 fql 显示 2012-11-19 我的网站显示 2012-11-18