白色屏幕在CodeIgniter中发布时

时间:2013-10-11 04:01:27

标签: codeigniter

每次发布​​表单时,Codeigniter都会显示一个白色屏幕:

这是控制器逻辑[controllers / account.php]:

class Account extends CI_Controller
{
   public function create()
   {
    if($this->input->post(NULL, TRUE)){
        $params = $this->input->post();
        //add validation layer
        $accountOptions = array($params are used here)
        $this->load->model('account/account', 'account');
        $this->account->initialize($accountOptions);
        $this->account->save();
    }
            $header['title'] = "Create Free Account";
    $this->load->view('front_end/header', $header);
    $this->load->view('main_content');
    $content['account_form'] = $this->load->view('forms/account_form', NULL, TRUE);
    $this->load->view('account/create', $content);
    $footer['extraJs'] = "account";
    $this->load->view('front_end/footer', $footer);
        }
 }

以下是帐户模型逻辑[models / account / account.php]:

 class Account extends CI_Model 
 {

    public function __construct()
{
    parent::__construct();
}

public function initialize($options)
{
      //initialize
    }
 }

首先加载视图,然后填写表单并单击“提交”,只需白页。 我试图将__construct添加到控制器并从那里加载帐户/帐户,表单甚至没有加载。有什么想法吗?

我刚发现问题:
- 模型帐户具有重复的定义,并且error_reporting已关闭!

2 个答案:

答案 0 :(得分:0)

您不应该有两个具有相同名称Account的类(控制器和模型)。检查它应该显示在那里的服务器和/或Codeigniter日志。

我建议您调用控制器类帐户和模型类M_Account。然后,您可以在加载时将模型重命名为帐户,就像您一样:

$this->load->model('account/m_account', 'account');

答案 1 :(得分:0)

public function __construct()
{
    parent::__construct();
$this->load->model("account/account");
}
you load model,library and helper files in construct dont load to inside a function