本文整理匯總了PHP中Video::switchOnById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Video::switchOnById方法的具體用法?PHP Video::switchOnById怎麽用?PHP Video::switchOnById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Video
的用法示例。
在下文中一共展示了Video::switchOnById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
}
if (isset($date_on) && $date_on == date("Y-m-d")) {
Mysql::getInstance()->delete('video_on_tasks', array('video_id' => $video_id));
}
if (isset($date_on) && $date_on != date("Y-m-d")) {
//var_dump($date_on, $_GET['id']); exit;
$video_on_task = Mysql::getInstance()->from('video_on_tasks')->where(array('video_id' => $video_id))->get()->first();
$data = array('video_id' => $video_id, 'date_on' => $date_on);
if (empty($video_on_task)) {
Mysql::getInstance()->insert('video_on_tasks', $data);
} else {
Mysql::getInstance()->update('video_on_tasks', $data, array('video_id' => $video_id));
}
} else {
if ($_GET['accessed'] == 1) {
Video::switchOnById($video_id);
} else {
Video::switchOffById($video_id);
}
}
header("Location: add_video.php?letter=" . @$_GET['letter'] . "&search=" . @urldecode($_GET['search']) . "&page=" . @$_GET['page']);
exit;
}
if (@$_GET['del']) {
Admin::checkAccess(AdminAccess::ACCESS_DELETE);
Video::log(intval(@$_GET['id']), _('video deleted'));
Mysql::getInstance()->delete('video', array('id' => intval(@$_GET['id'])));
header("Location: add_video.php?letter=" . @$_GET['letter'] . "&search=" . @$_GET['search'] . "&page=" . @$_GET['page']);
exit;
}
if (count(@$_POST) > 0) {
示例2: foreach
<?php
include "./common.php";
$today_tasks = Mysql::getInstance()->from('video_on_tasks')->where(array('date_on<=' => 'CURDATE()'))->get()->all();
foreach ($today_tasks as $task) {
try {
Video::switchOnById($task['video_id']);
Mysql::getInstance()->delete('video_on_tasks', array('id' => $task['id']));
} catch (Exception $e) {
echo $e->getTraceAsString();
}
}