本文整理匯總了PHP中Random::playlist方法的典型用法代碼示例。如果您正苦於以下問題:PHP Random::playlist方法的具體用法?PHP Random::playlist怎麽用?PHP Random::playlist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Random
的用法示例。
在下文中一共展示了Random::playlist方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Artist
break;
case 'artist':
$artist_id = Random::artist();
if (!$artist_id) {
$results['rfc3514'] = '0x1';
break;
}
$artist = new Artist($artist_id);
$songs = $artist->get_songs();
foreach ($songs as $song_id) {
$GLOBALS['user']->playlist->add_object($song_id, 'song');
}
$results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
case 'playlist':
$playlist_id = Random::playlist();
if (!$playlist_id) {
$results['rfc3514'] = '0x1';
break;
}
$playlist = new Playlist($playlist_id);
$items = $playlist->get_items();
foreach ($items as $item) {
$GLOBALS['user']->playlist->add_object($item['object_id'], $item['object_type']);
}
$results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
case 'advanced_random':
$object_ids = Random::advanced('song', $_POST);
// First add them to the active playlist
if (is_array($object_ids)) {