SRCMS
SRCMS(轻响应)企业应急响应中心开发框架模版
This commit is contained in:
51
Application/User/Controller/RegController.class.php
Normal file
51
Application/User/Controller/RegController.class.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace User\Controller;
|
||||
use Think\Controller;
|
||||
|
||||
/**
|
||||
* @author Zhou Yuyang <1009465756@qq.com> 2015-07-27
|
||||
* @copyright ©2105-2018 SRCMS
|
||||
* @homepage http://www.src.pw
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 注册页面
|
||||
*/
|
||||
class RegController extends Controller{
|
||||
/**
|
||||
* 用户列表
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
//默认显示添加表单
|
||||
if (!IS_POST) {
|
||||
$this->display();
|
||||
}
|
||||
if (IS_POST) {
|
||||
//如果用户提交数据
|
||||
$model = D("Member");
|
||||
if (!$model->create()) {
|
||||
// 如果创建失败 表示验证没有通过 输出错误提示信息
|
||||
$this->error($model->getError());
|
||||
exit();
|
||||
} else {
|
||||
if ($model->add()) {
|
||||
$this->success("用户添加成功", U('index/index'));
|
||||
} else {
|
||||
$this->error("用户添加失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user