本文整理汇总了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);
}
}