Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter提要自发布后获得时间-php_Php_Twitter - Fatal编程技术网

Twitter提要自发布后获得时间-php

Twitter提要自发布后获得时间-php,php,twitter,Php,Twitter,我用这个来生成我的推特提要: # Access as an object $tweetText = $tweet->text; $tweetDate = $tweet->created_at; # Make links active $tweetText = preg_replace("/(http:\/\/|www.)(([^\s<]{4,68})[^\s<]*)/", '<a href="http://$2$3" tar

我用这个来生成我的推特提要:

    # Access as an object
    $tweetText = $tweet->text;
    $tweetDate = $tweet->created_at;

    # Make links active
    $tweetText = preg_replace("/(http:\/\/|www.)(([^\s<]{4,68})[^\s<]*)/", '<a href="http://$2$3" target="_blank">$1$2$4</a>', $tweetText);

    # Linkify user mentions
    $tweetText = preg_replace("/@(w+)/", '<a href="http://www.twitter.com/$1" target="_blank">@$1</a>', $tweetText);

    # Linkify tags
    $tweetText = preg_replace("/#(w+)/", '<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>', $tweetText);

    # Output
    echo $tweetText;
    echo '<br><span>Posted: ';
    echo $tweetDate;
    echo '</span>';
    echo '<br> <br>';
#作为对象访问
$tweetText=$tweet->text;
$tweetDate=$tweet->created_at;
#激活链接
$tweetText=preg\u replace(“/(http:\/\/\www.)([^\s使用以下代码:

$tweetDate  =   strtotime($tweetDate); 

$diff   =   time()-$tweetDate;

if($diff<60){
    echo $diff." sec ago";
}else if($diff<(60*60)){
    echo round($diff/60)." minute ago";
}else if($diff<(60*60*24)){
    echo round($diff/(60*60))." hours ago";
}else{
    echo round($diff/(60*60*24))." days ago";
}
$tweetDate=strottime($tweetDate);
$diff=time()-$tweetDate;

如果($diff
$tweetDate
当前为2014年4月29日星期二09:43:17+0000
使用$tweetDate=strotTime($tweetDate);