<?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)后,它显示一个空白页面。评论标题页后,它正在运行I.E.成功页面即将到来。
答案 0 :(得分:0)
我认为您需要load
helper
也高于它:
$this->load->helper('url');