0
<?php 
class Customer extends CI_controller
{

public function __construct()
{
    parent::__construct();
    $this->load->model('Customer_model');


}
public function create()
{

    $this->load->helper('form');
    $this->load->library('form_validation');
    $this->form_validation->set_rules('name', 'Title', 'required');
    $this->form_validation->set_rules('address', 'text', 'required');

    if ($this->form_validation->run() === FALSE)
    {

    $this->load->helper('url');
    $this->load->view('templates/header');  
    $this->load->view('master/customer');

    }
    else
    {
    $this->Customer_model->register();

    $this->load->view('templates/header');
    $this->load->view('templates/success');
    }
    }
}

このコードを使用して、テーブルにデータを正常に挿入しました。同じヘッダー テンプレートと中央部分 (success.php) を表示しようとすると、空白のページが表示されます。ヘッダー ページにコメントした後、動作している IE 成功ページが来ています。

4

1 に答える 1

0

loadその上にも必要だと思いますhelper

$this->load->helper('url');
于 2013-03-22T11:03:37.487 に答える