-2
對於CI我是新的,因爲MVC我認爲我的代碼不好。Codeigniter個人將數據從控制器傳遞到模型
我的控制器:
public function index(){
$this->data->report = $this->order_m->get_report();
parent::_view('report/list',$this->data);
}
我的模型
public function get_report(){
//somecode
if ($this->input->post('submit')){
$start_date = $this->input->post('thn_start').'-'.$this->input->post('bln_start').'-01';
$end_date = $this->input->post('thn_end').'-'.$this->input->post('bln_end').'-31';;
} else {
$start_date = date('Y-m-d',strtotime("-62 day"));
$end_date = date('Y-m-d');
}
$this->db->where('date_in BETWEEN "'. date('Y-m-d', strtotime($start_date)). '" and "'. date('Y-m-d', strtotime($end_date)).'"');
$this->db->order_by('id_order','desc');
//somecode
}
我怎樣才能爲MVC風格的代碼?由於
爲什麼不嘗試閱讀[文檔](http://www.codeigniter.com/user_guide/overview/mvc.html)和下面的[教程](http://www.codeigniter.com/user_guide/tutorial /index.html)首先? – Sparky