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 がオフになっていました。