本文整理匯總了PHP中Playlist::exists方法的典型用法代碼示例。如果您正苦於以下問題:PHP Playlist::exists方法的具體用法?PHP Playlist::exists怎麽用?PHP Playlist::exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Playlist
的用法示例。
在下文中一共展示了Playlist::exists方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generateId
public static function generateId($length)
{
$idExists = true;
while ($idExists) {
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$id = '';
for ($i = 0; $i < $length; $i++) {
$id .= $chars[rand(0, strlen($chars) - 1)];
}
$idExists = Playlist::exists(array('id' => $id));
}
return $id;
}
示例2: checkOwner
public static function checkOwner($user, $rule)
{
$rule = false;
$playList = new Playlist();
$userId = $user->id;
if (!isset($_GET['id'])) {
return $rule;
}
$playListId = $_GET['id'];
if ($playList->exists("id={$playListId} AND uid={$userId}")) {
$rule = true;
}
return $rule;
}
示例3: watch
public function watch($parameters, $request)
{
$playlist_id = $parameters[1];
if (Playlist::exists($playlist_id)) {
$playlist = Playlist::find($playlist_id);
if (isset($parameters[3])) {
$video_id = $parameters[3];
} else {
$video_id = json_decode($playlist->videos_ids);
if (isset($video_id[0])) {
$video_id = $video_id[0];
} else {
$data = array();
$data['playlist'] = $playlist;
return new ViewResponse('playlists/error_empty', $data);
}
}
if (in_array($video_id, json_decode($playlist->videos_ids))) {
$resp = new VideoController();
return $resp->get($video_id, $request, $playlist);
} else {
return new Response(500);
}
} else {
return new Response(500);
}
}