每次发布表单时,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 已关闭!