在下面的控制器中使用此site_model會給我一個500內部錯誤。我甚至無法將模型添加到我的索引中。我可以在另一個控制器中使用這個模型,而不是索引。Codeigniter模型未在控制器中加載
我的模型類有什麼問題嗎?
class Site_model extends CI_Model{
function getAll(){
$q = $this->db->get('ci_test');
if($q->num_rows() > 0){
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
function getAllCup(){
$q = $this->db->get('cup');
if($q->num_rows() > 0){
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
function getOrderCup(){
session_start();
$order = $_SESSION['order'];
$this->db->select('product_id','name','description','price');
foreach($order as $product):
$this->db->where('product_id', $product['product_id']);
endforeach;
$q = $this->db->('cup');
if($q->num_rows() > 0){
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
}
/////
class Checkout extends CI_Controller{
function index()
{
$data['main_content'] = "checkout";
$this->load->view("includes/template",$data);
}
function review()
{
$this->load->model('site_model');
/*echo json_encode($this->site_model->getOrderCupcakes());*/
echo "sfsfdsf";
}
}
顯示您的控制器代碼 –
它在那裏,向下滾動。他們連接 – Adam
@亞當你必須看到我的答案,我希望你能發現你的問題 –