1
我有一個腳本,可以從播放列表中拖動YouTube視頻縮略圖,當您將鼠標懸停在它們上方時,會顯示視頻標題,我想刪除前24個字符每次自動顯示標題標籤?我該怎麼做呢?這是否需要用正則表達式來完成,如果是的話,怎麼樣?刪除YouTube API標題標記開頭的前24個字符
的PHP代碼我的設置是:
<?php get_playlists(); ?>
<?php
function get_playlists(){
$data = file_get_contents("http://gdata.youtube.com/feeds/api/playlists/C82EBDAC0429B6A2? orderby=published&max-results=12");
$xml = simplexml_load_string($data);
foreach($xml->entry as $playlist){
$media = $playlist->children('http://search.yahoo.com/mrss/');
$attrs = $media->group->thumbnail[1]->attributes();
$thumb = $attrs['url'];
$attrs = $media->group->player->attributes();
$video = $attrs['url'];
$title = $media->group->title;
$url = $video;
parse_str(parse_url($url, PHP_URL_QUERY), $my_array_of_vars);
$vid_Id = $my_array_of_vars['v'];
$thumbnail .= '<div style="float:left; cursor:pointer;">
<p class="crop"><a class="videobox various iframe" href="http://www.youtube.com/embed/' . $vid_Id . '?autoplay=1&hd=1"><img src="' .$thumb . '" title="' . $title . '" width="74" height="56"/></a></p></div>';
}
print $thumbnail;
}
?>
謝謝天才! – cbg 2012-07-09 21:57:53