나는 튜토리얼을 수행 중이며 500 문제가 있습니다. 문제가 모델에 의한 것인지 아닌지는 잘 모르겠습니다. 내 모델 :500 내부 서버 오류 CodeIgniter
<?php
class Cat_model extends CI_Model{
public function __construct()
{
$this->load->database();
}
function getCategory($id){
$data = array();
//select one row matching that ID from the categories table
$options = array('id'=>$id);
$q = $this->db->get_where('categories',$options,1);
if($q->num_rows()>0){
$data = $q->row_array();
}
$q->free_result();
return $data;
}
function getAllCategories(){
$data = array();
$q = $this->db->get('categories');
if($q->num_rows()>0){
foreach ($q->result_array() as $row){
$data[] = $row;
}
}
$q->free_result();
return $data;
}
}
내 컨트롤러 :
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{//homepage
$data['title'] = "Welcome to TM testDIY";
$data['navlist'] = $this->cat_model->getAllCategories();
$this->load->var($data);
$this->load->view('template');
}
}
데이터베이스
$db['default']['database'] = 'testDIY';
과 내가 자동로드 파일에서 모델을 자동로드했습니다.
데이터베이스를 비우거나 임의의 이름을 입력하면 내부 서버 오류 500이 표시되지 않고 의미있는 오류 메시지가 표시됩니다. 지금 문제를 파악할 수 없습니까? 누구든지 도와 드릴 수 있습니까?
의 그것은 일반적으로 서버 오류를 의미
를 사용하고 여기에 보인다. 어쩌면 그것은 나쁜 요청 일 것입니다. – gooddadmike