嗨,我想從視圖調用模型,但我得到的錯誤爲。如何從視圖調用模型
A PHP Error was encountered Severity: Notice Message: Undefined property:
CI_Loader::$Stopsmap_Model Filename: stopsmap/index.php Line Number: 59
我view.But tryed這下面的代碼沒有運氣提前
foreach ($routes as $route_details):
//calling model
//$trip_max_min_sequence_details = $this->load->Stopsmap_Model->fullTripdetails($trips->trip_id); i tried this also but same error
//$this->load->model('Stopsmap_Model');
//$data = $this->stopsmap_model->fullTripdetails($route_details->route_id); i tried this also but same error
$this->load->model('fixedtransit_model/Stopsmap_Model');
$get_route_related_trips = $this->Stopsmap_Model->getRoutetrips($route_details->route_id);
if(count($get_route_related_trips)>=1):
echo '1 stop';
endif;
endforeach;
感謝我已經創建了一個名爲accountmodel在應用程序的模型在我結束 幫助
你爲什麼不叫它從加載視圖並將變量傳遞給視圖的控制器? – IJas
!!你爲什麼想要在你的視圖中調用一個模型.. –
實際上有一個旅行列表名稱.in,這將是停止。我需要顯示旅行名稱列表,這是最少有一站,所以我是在foreach循環中檢查.u可以在視圖代碼 –