/** * 校验姓名是否存在. * * @access public * @return void * @author Liuping <*****@*****.**> */ public function ajaxCheckFullName() { $familyName = trim(I('post.familyName', '')); $firstName = trim(I('post.firstName', '')); $result = []; if (empty($familyName) || empty($firstName)) { $result['status'] = -1; $result['msg'] = 'Conditions not completed'; } else { $model = new MemberStuModel(); $info = $model->checkExistFullName($familyName, $firstName); if (FALSE === $info) { // 不存在 $result['status'] = 0; $result['msg'] = ''; } else { // 已存在 $result['status'] = 1; $result['msg'] = 'This student name has been added previously!'; } } if (IS_AJAX) { $this->ajaxReturn($result, 'json'); } }