如何在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);
}
}
答案 0 :(得分:3)
试试这个
$route['confirm_registration/(:any)']= "login/confirm_registration/$1";