2015-08-18 77 views
0

我是CodeIgniter中的新成員,並且URL有問題。當我打開我的網址,如www.abc.com/france它的工作正常,但當URLs來像www.abc.com/united_state頁面打開,但頁面的所有內容都沒有正確顯示。此外分頁不起作用(只顯示單頁)。我的控制器代碼是如何在URL中包含CodeIgniter中的下劃線字符時允許

$searchkey =$this->uri->segment(3); 

    $searchkey = urldecode(str_replace('_',' ',$searchkey)); 
    $checkin =$this->uri->segment(4); 
    $checkout = $this->uri->segment(5); 
    $newkey=$this->uri->segment(5); 
       } 

if(preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $checkin) && preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $checkout)) 
    { 
     //echo "hello"; 
     $last1=$last1+2; 
     switch($last1) 
{ 
case 5: 


$searchkey=$this->uri->segment(3); 


$column = "CountryName";$master = "country";$master2 = "CountryName"; 
$getdata = $this->searchdata_model->get_listing_data_list($column,$searchkey,$checkin,$checkout,$master,$newkey); 
$latest_listing = $this->searchdata_model->get_lastest_properties($searchkey,$master2); 
$data['latest_listing'] = $latest_listing; 
break; 

我認爲問題出在preg_match函數中。

回答

1

允許

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; 
+0

它已在config.php中定義config/config.php文件中的下劃線, –

相關問題