如何在CodeIgniter中使用路由?我試過但沒有結果。這是我的觀點:如何在CodeIgniter中使用路由
<a href="/survey/index.php/index/student_surveys/1/" class='btn btn-success'> 1 </a>
<a href='/survey/index.php/index/student_surveys/2/'class='btn btn-success'> 2 </a>
<a href='/survey/index.php/index/student_surveys/3/'class='btn btn-success'> 3 </a>
我試着用這樣的:
$route['survey/index.php/index/student_surveys/1/'] = 'index/student_surveys/1/';
$route['survey/index.php/index/student_surveys/2/'] = 'index/student_surveys/1/';
但是,當我改變鏈路測試,它不會改變。它只適用於我的鏈接而不是路由。我的控制器:
public function student_surveys() {
$this->form_validation->set_rules('teacher', 'Teacher', 'required');
$this->form_validation->set_rules('subject', 'Subject', 'required|callback_subject');
if ($this->form_validation->run()==FALSE)
{
$this->student_surveys_show();
}
else
{
$this->user_model->add_teacher_subject();
redirect('/index/survey_show/' . $survey_id);
}
}
你有沒有嘗試過,'$這個 - >負載>視圖( 'survey_show',$ survey_id,TRUE);' ? –
我想使用路線。 :) –