这就是函数
function get_latestvideo($username)
{
$videos = array();
$data = "http://gdata.youtube.com/feeds/api/users/{$username}/uploads?start-index=1&max-results=4&v=2&alt=json";
foreach (json_decode(file_get_contents("$data"))->feed->entry as $video)
{
$videos[] = array(
'title' => $video->title->{'$t'},
'desc' => $video->{'media$group'}->{'media$description'}->{'$t'},
'url' => $video->content->src,
'thumbnail' => $video->{'media$group'}->{'media$thumbnail'}[1]->url,
);
}
return $videos;
}这是直接来自API的描述
"media$description": {
"$t": "Enjoy, Like, Comment, Subscribe\nGiggleSquid's Twitter: https://twitter.com/GiggleSquid\nGigglesquid's Facebook: http://www.facebook.com/GiggleSquid\n\nGiggleSquid and dapaka delve into SimCity in a hopeless attempt to develop an efficient, bustling metropolis, will they succeed? No, probably not\n\nOutro Music:\nOne-eyed Maestro by the amazing Kevin MacLeod (incompetech.com)",
"type": "plain"
},这就是它的打印方式
享受,喜欢,评论,订阅GiggleSquid的推特:https://twitter.com/GiggleSquid GiggleSquid的Facebook:http://www.facebook.com/GiggleSquid GiggleSquid和dapaka钻研SimCity,无望地试图开发一个高效,繁华的大都市,他们会成功吗?不,可能不是奥特罗音乐:令人惊叹的凯文·MacLeod (incompetech.com)的独眼大师
发布于 2013-05-12 12:38:12
使用nl2br() PHP函数将\n转换为BR标记
https://stackoverflow.com/questions/16504232
复制相似问题