我的CodeIgniter小型項目(只是爲了熟悉它,它實際上就像他們的教程的例子)它停止工作,給我沒有輸出或錯誤,甚至在index.php文件設置爲研究與開發...CodeIgniter:應用程序不工作,並不會記錄錯誤
所以我試着用一些回聲的
調試它自己,我發現這裏停止記錄
class News extends CI_Controller {
public function __construct()
{
parent::__construct();
echo 'This is echoed';
$this->load->model('news_model');
echo 'This wont be echoed';
}
/*(class continues)*/
}
而且我news_model.php看起來像這樣:
<?php
class News_model extends CI_Model {
public function __construct()
{
$this->load->database();
}
public function get_news($slug = FALSE)
{
if ($slug === FALSE)
{
$query = $this->db->get('news'{});
return $query->result_array();
}
$query = $this->db->get_where('news', array('slug' => $slug));
return $query->row_array();
}
public function set_news()
{
$this->load->helper('url');
$slug = url_title($this->input->post('title'), 'dash', TRUE);
$data = array(
'title' => $this->input->post('title'),
'slug' => $slug,
'text' => $this->input->post('text')
);
return $this->db->insert('news', $data);
}
}
任何想法我做錯了什麼?
CNC中
public function __construct()
{
echo '__construct()';
$this->load->database();
echo 'after__construct()';
}
他們都不是迴盪......
是否在News_model構建運行?你有沒有設置你的數據庫參數? – karmafunk 2013-05-08 09:12:59
它不...我添加了我測試的問題 – 2013-05-08 09:15:47