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函數中。
它已在config.php中定義
config/config.php
文件中的下劃線, –