$route['write-qb/(:any)/(:any)/(:any)'] ne fonctionne pas.
<p>Lorsque j'utilise les segments uri 2 et 3, cela fonctionne, mais lorsque j'ajoute le segment uri 4, cela ne fonctionne pas. </p><p>L'URL devrait ressembler à ceci... http://localhost/maruf/writing-qb/bcs/44th-bcs-english/how-has-the-phrase-digital-detox- été-expliqué-dans-le-passage ? </p><p>Mais cela apparaît comme... http://localhost/maruf/writing-qb/bcs/how-has-the-phrase-digital-detox-been-explained-in-the - Passage? Et les deux URL affichent 404. </p><p>Voici mes paramètres de routage.</p><p><br /></p>
<pre class="brush:php;toolbar:false;">$route['écrit-qb/(:num)'] = 'écrit-qb'; //travaux
$route['écrit-qb/(:any)/(:any)'] = 'écrit-qb/écrit_qb_details/$1/$2'; //travaux
$route['écrit-qb/(:any)/(:any)/(:any)'] = 'écrit-qb/écrit_qb_answer/$1/$2/$3'; //ne fonctionne pas</pre>
<p>Mon contrôleur est...</p>
<pre class="brush:php;toolbar:false;">public function index(){
$data['qb_list'] = $this->Question_bank_model->get_qb_with_category(FALSE);
//données du pied de page
$data['main_content'] = 'écrit_qb';
$this->load->view('include/template',$data);
} // fonctionne bien
fonction publique written_qb_details ($category, $slug = NULL){
$config['uri_segment'] = 2;
$slug = $this->uri->segment(3);
//données
$data['qb_list'] = $this->Question_bank_model->get_qb_with_category(FALSE);
$data['qb_info'] = $this->Question_bank_model->get_qb_details($slug, $config['uri_segment']);
si(vide($data['qb_info'])){
show_404();
}
$data['url_slug'] = $data['qb_info']['qb_exam_slug'];
$data['meta_title'] = $data['qb_info']['qb_exam'];
$data['meta_description'] = $data['qb_info']['qb_exam_post_meta'];
$data['meta_keywords'] = $data['qb_info']['qb_exam_post_tags'];
//voir
$data['main_content'] = 'écrit_qb_details';
$this->load->view('include/template',$data);
} // fonctionne bien
fonction publique written_qb_answer($slug = NULL, $slug2 = NULL){
$config['uri_segment'] = 2;
$slug = $this->uri->segment(3);
$slug2 = $this->uri->segment(4);
//données
$data['qb_info'] = $this->Question_bank_model->get_qb_answer_details($slug, $slug2, $config['uri_segment']);
si(vide($data['qb_info'])){
show_404();
}
$data['url_slug'] = $data['qb_info']['qb_exam_question_slug'];
$data['meta_title'] = $data['qb_info']['qb_exam_question'];
$data['meta_description'] = $data['qb_info']['qb_exam_answer_meta'];
$data['meta_keywords'] = $data['qb_info']['qb_exam_answer_tags'];
//voir
$data['main_content'] = 'réponse';
$this->load->view('include/template',$data);
}// ça ne marche pas</pre>
<p>而我的模型是...</p>
<pre class="brush:php;toolbar:false;">fonction publique get_qb_details($slug = FALSE){
si($slug === FAUX){
$this->db->order_by('qb_post.qb_exam_slug', 'DESC');
$this->db->join('qb_category', 'qb_category.qb_category_name_slug = qb_post.qb_category_name_slug');
$this->db->where('qb_exam_active',1);
$query = $this->db->get('qb_post');
return $query->result_array();
}
$query = $this->db->get_where('qb_post', array('qb_exam_slug' => $slug));
return $query->row_array();
}
fonction publique get_qb_answer_details($slug2 = FALSE){
si($slug2 === FAUX){
$this->db->where('qb_exam_answer_active',1);
$query = $this->db->get('qb_exam_ans');
return $query->result_array();
}
$query = $this->db->get_where('qb_exam_ans', array('qb_exam_question_slug' => $slug2));
return $query->row_array();
}</pré>
<p>在控制器"writing_qb_answer"中,以及在路由$route['écrit-qb/(:any)/(:any)/(:any)'] = 'écrit-qb/écrit_qb_answer/$1/$2 /$3';中,不起作用。它显示404错误。</p>