C层: <?php namespace app\admin\controller; use think\Controller; use app\admin\model\User; class Index extends Controller { public function index() { return $this->fetch(); } //注册 public function add() { //接值 $data = input('post.'); //实例化模型 $user = new User(); //用户名唯一性验证 $users = $user->where("uname = '$data[uname]'")->find(); if($users){ $this->error('用户名已存在','index/index'); } //数据添加 $datas = $user->save($data); if($datas){ $this->success('success','index/login'); }else{ $this->error('error','index/index'); } } public function login() { return $this->fetch(); } //登录 public function logins() { //接值 $data