当前位置: 首页>>代码示例>>PHP>>正文


PHP Subject::getSubjectById方法代码示例

本文整理汇总了PHP中Subject::getSubjectById方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::getSubjectById方法的具体用法?PHP Subject::getSubjectById怎么用?PHP Subject::getSubjectById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subject的用法示例。


在下文中一共展示了Subject::getSubjectById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: date

<?php

/**
 *
 */
if (isset($_SESSION['subject_id'])) {
    //Subject name
    $subjectName = Subject::getSubjectById($_SESSION['subject_id']);
}
?>

<h2><?php 
echo $subjectName;
?>
's Lessons</h2>
<br>
<?php 
//echo $_GET['subject_id'/*. " ee "*/];
$lessonsList = Lesson::getLessonsBySubjectId($_GET['subject_id']);
foreach ($lessonsList as $lesson) {
    //format the date
    $lessonDate = date("d/m/y", strtotime($lesson->getDate()));
    echo '<div class="sidebar-link"><a href="main.php?sidebar=lessons&subject_id=' . $lesson->getSubjectId() . '&content=doc&lesson_id=' . $lesson->getId() . '">' . $lessonDate . " - " . $lesson->getTitle() . "</a></div>";
}
?>
<br><br>

<?php 
//$_SESSION['class_id'] = $_GET['class_id'];
?>
<a href="main.php?sidebar=subject&class_id=<?php 
开发者ID:pinair,项目名称:ClassCrowd,代码行数:31,代码来源:lessons.php

示例2: while

 <?php 
$connection = Database::getConnection();
$query = "SELECT class FROM class WHERE id=" . $_GET['class_id'];
$result_obj = $connection->query($query);
//I COULD USE A FOR AND IT WOULD BE BETTER
//BUT IT DOESN'T WORK AND I HAVE NO TIME TO
//FIND THE PROBLEM :)
$i = 0;
while ($result = $result_obj->fetch_array(MYSQLI_ASSOC)) {
    $class = $result;
    $i++;
}
if (isset($_GET['subject_id'])) {
    //Subject name
    $subjectName = Subject::getSubjectById($_GET['subject_id']);
}
?>


<h2><?php 
echo $class['class'] . ' / ';
?>
<span id="subject-title">Subjects <span id="subject-sub-title">
<?php 
if (isset($subjectName)) {
    echo " / " . $subjectName;
}
?>
</span></span></h2>

开发者ID:pinair,项目名称:ClassCrowd,代码行数:29,代码来源:subject.php


注:本文中的Subject::getSubjectById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。