我目前正在开发一个页面应用程序,允许用户安排他们的页面帖子。正如在facebook文档中给出的那样,我必须使用unix time stamp
,但由于应用程序存储在服务器中,因此它将始终使用mktime()
相应的服务器时间创建一个unix时间戳。
现在假设来自不同地方的不同人需要安排帖子,我如何安排他们给定时间的帖子?
答案 0 :(得分:0)
您必须设置时区以创建时间戳。
$timezone= ''Americas/New_York';
$date = new DateTime($dateStr, new DateTimeZone($timezone));
or
date_default_timezone_set('Americas/New_York');
$date = strtotime($dateStr);
$attachment = array(
'message' => $data['facebook_text'],
'name' => $data['name'],
'link' => $this->getLinkToLatestNews(),
'description' => '',
'scheduled_publish_time' => $date
);
$facebook->api('/PAGE ID/feed/', 'post', $attachment);
注意:页面帖子应该上线的时间,这应该是从发布帖子开始的10分钟到6个月之间。
请参阅: