|
楼主 |
发表于 2017-3-15 15:35:23
|
显示全部楼层
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Regist extends CI_Controller{
public function __construct(){
// 在构造函数中自动加载
parent::__construct();
$this->load->model('user_model','user'); //自动加载模型类
}
public function index(){
$this->load->helper('form');
$data['tit']="注册";
//$this->load->view('admin/sign-up.html','$data');
$this->load->library('form_validation');
$status=$this->form_validation->run('regist');
if($status){
$data=array(
'email'=>$this->input->post('email'),
'username'=>$this->input->post('username'),
'password'=>$this->input->post('password')
);
$this->user->add($data);
success('regist/show','添加成功');
}else{
$this->load->view('admin/sign-up.html','$data');
}
}
} |
|