本文整理匯總了PHP中Subject::find_by_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subject::find_by_id方法的具體用法?PHP Subject::find_by_id怎麽用?PHP Subject::find_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Subject
的用法示例。
在下文中一共展示了Subject::find_by_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: selected_page
function selected_page()
{
global $current_subject;
global $current_page;
if (isset($_GET['subject'])) {
$current_subject = Subject::find_by_id($_GET['subject']);
$current_page = null;
} elseif (isset($_GET['page'])) {
$current_page = Page::find_by_id($_GET['page']);
$current_subject = null;
} else {
$current_subject = null;
$current_page = null;
}
}
示例2: redirect_to
<?php
require_once "../../includes/initialize.php";
?>
<?php
// if(!$session->is_logged_in()) {
// redirect_to('login.php');
// }
if (!isset($_GET['subject'])) {
redirect_to('manage_admins.php');
}
$subject = Subject::find_by_id($_GET['subject']);
if ($subject && $subject->delete()) {
$session->message("Admin was deleted");
redirect_to("manage_content.php");
} else {
$session->message("Unable to delete the admin");
redirect_to("manage_content.php");
}
// TASK
// Find out how to perform cascade deleting