我有一个php MVC超链接,该超链接可以在单击时重定向到index.php页面,而不是转到指定的视图路径。没有错误,通知或警告。
下面是菜单列表
<ul>
<li id="HTMLID" class="first fourColumns"><a href="index.php">Home</a></li>
<li><a href='index.php?action=get_subjects&class=<?php echo $classes[0]['class_id']; ?>'>My Subjects</a></li>
<?php if ($myclass > 0):?>
<li><a href='index.php?action=get_classes&teacher=<?php echo $_SESSION['userinfo']['id']; ?>'>My Class</a></li>
<?php endif; ?>
<li><a href="report.php">Report</a></li>
</ul>
下面是控制器类
<?php
class indexController extends Controller11
{
function __construct()
{
if(isset($_GET['class']))
$this->class = $_GET['class'];
//parent::Controller11();
}
function index()
{
include(VIEWPATH."home.php");
}
function get_subjects()
{
$school_obj = new school();
$sch_info = $school_obj->select_all(array('picture'));
$this->class = $_GET['class'];
$teacher_obj = new teacher();
$subjects = $teacher_obj->get_subjects($_SESSION['userinfo']['id'],$this->class);
$subjects_notes = $teacher_obj->get_notes($_SESSION['userinfo']['id'],$this->class);
$_SESSION['work']['teacher'] = $_SESSION['userinfo']['id'];
include(VIEWPATH."your_subjects.php");
}
function get_classes()
{
$school_obj = new school();
$sch_info = $school_obj->select_all(array('picture'));
$this->class = $_GET['class'];
$teacher_obj = new teacher();
$classes = $teacher_obj->get_classes($_SESSION['userinfo']['id']);
$class_obj = new schoolClass();
$student_count = $teacher_obj->get_student_count($this->class,$session,$term);
$_SESSION['work']['teacher'] = $_SESSION['userinfo']['id'];
include(VIEWPATH."your_class.php");
}
}
我已经将本地xammp更新为7.2版,它仍然可以工作,但是在7.2版的Web服务器上却什么也没做。有人知道为什么吗?还是可以发现做错了什么?
答案 0 :(得分:0)
我已经整理好了。由于某种原因,当我删除__construct函数时,它再次开始工作。
我必须研究__construct函数及其用途。