当前位置: 首页>>代码示例>>PHP>>正文


PHP UserModel::getError方法代码示例

本文整理汇总了PHP中UserModel::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::getError方法的具体用法?PHP UserModel::getError怎么用?PHP UserModel::getError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserModel的用法示例。


在下文中一共展示了UserModel::getError方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: auth

 function auth()
 {
     $code = g('code');
     require_once ST_MODEL_DIR . 'UserModel.php';
     $userModel = new UserModel();
     $user = $userModel->loginOrRegisterUserByCode($code);
     if ($userModel->getError()) {
         die($userModel->getErrorMessage());
     }
     if ($user) {
         Http::redirect('/');
     } else {
         Http::redirect('loginError');
     }
 }
开发者ID:aliwebir,项目名称:ocarina_technologies,代码行数:15,代码来源:User.php

示例2: testModifyUserById

 public function testModifyUserById()
 {
     $table = new UserModel();
     $ret = $table->getUserByPhone('222222');
     $table->modifyUserById($ret['id'], null, '李四改', '武汉', 'abc123', 'abc123', 'tmp.jpg');
     $ret = $table->getUserById($ret['id']);
     $this->assertTrue($ret['phone'] == '222222' && $ret['nickname'] == '李四改' && $ret['address'] == '武汉' && $ret['img'] == 'tmp.jpg');
     $ret = $table->getUserByPhone('222222');
     $ret = $table->modifyUserById($ret['id'], '111111');
     $this->assertTrue($ret == false);
     $this->assertTrue($table->getError()['phone'] == '手机号码已被注册');
     $ret = $table->modifyUserById($ret['id'], null, '真图');
     $this->assertTrue($ret == false);
     $this->assertTrue($table->getError()['nickname'] == '昵称不能用');
     $ret = $table->getUserByPhone('222222');
     $table->modifyUserById($ret['id'], null, '李四改改', '武汉', 'abc123', 'bb', 'tmp.jpg');
     $this->assertTrue($table->getError()['repassword'] == '两次输入密码不一致');
 }
开发者ID:chen8840,项目名称:LMJ-s-project,代码行数:18,代码来源:UserModelTest.php

示例3: saveuserinfo

 public function saveuserinfo()
 {
     $id = session('userid');
     if (!empty($id)) {
         $user = new UserModel();
         $data = $user->create();
         if (false !== $user->save()) {
             $this->message2('编辑成功', 'reinfo');
         } else {
             $this->message2('编辑失败' . $user->getError(), 'reinfo');
         }
     } else {
         $this->message2('请选择编辑对象', __URL__ . '/index');
     }
 }
开发者ID:kwdwkiss,项目名称:kongbao8,代码行数:15,代码来源:UserAction.class.php

示例4: passsave

 public function passsave()
 {
     $user = new UserModel();
     $id = I('id', 0);
     if ($data = $user->create()) {
         if (0 < $id) {
             $data['password'] = md5($data['password']);
             if (false !== $user->where('id=\'' . $id . '\'')->data($data)->save()) {
                 $this->message('操作成功', __URL__ . '/index');
             } else {
                 $this->message('操作失败:' . $user->getDbError(), __URL__ . '/index');
             }
         } else {
             $this->message('请选择编辑用户', __URL__ . '/index');
         }
     } else {
         $this->message('操作失败:数据验证( ' . $user->getError() . ' )', __URL__ . '/index');
     }
 }
开发者ID:kwdwkiss,项目名称:kongbao8,代码行数:19,代码来源:UserAction.class.php

示例5: UserModel

 /**
  * 更新 个人资料
  */
 function update_profile()
 {
     $user = new UserModel();
     $username = $_SESSION['username'];
     $userinfo = $user->getByUsername($username);
     //如果旧密码正确
     if (md5($_POST['old_password']) == $userinfo['password']) {
         if (!!($data = $user->create())) {
             if ($user->save() !== false) {
                 $this->assign('jumpUrl', __APP__ . '/Manage/index');
                 $this->success('修改个人资料成功');
             } else {
                 $this->assign('jumpUrl', __URL__ . '/profile');
                 $this->error('更新失败' . $user->getDbError());
             }
         } else {
             $this->assign('jumpUrl', __URL__ . '/profile');
             $this->error('更新失败' . $user->getError());
         }
     } else {
         $this->assign('jumpUrl', __URL__ . '/profile');
         $this->error('您输入的旧密码不正确');
     }
 }
开发者ID:omusico,项目名称:AndyCMS,代码行数:27,代码来源:UserAction.class.php

示例6: saveuserinfo

 public function saveuserinfo()
 {
     $id = session('userid');
     if (!empty($id)) {
         $postData = array_intersect_key($_POST, array_flip(['id', 'nickname', 'email', 'telphone']));
         $user = new UserModel();
         $data = $user->create($postData);
         if (false !== $user->save()) {
             $this->message2('编辑成功', 'reinfo');
         } else {
             $this->message2('编辑失败' . $user->getError(), 'reinfo');
         }
     } else {
         $this->message2('请选择编辑对象', __URL__ . '/index');
     }
 }
开发者ID:kwdwkiss,项目名称:kongbao,代码行数:16,代码来源:UserAction.class.php

示例7: adding

 public function adding()
 {
     $data['username'] = $this->_post('username');
     $data['yourname'] = $this->_post('yourname');
     $data['password'] = md5($this->_post('password'));
     $data['status'] = $this->_post('status');
     $user = new UserModel('user');
     if (!$user->create()) {
         // 如果创建失败 表示验证没有通过 输出错误提示信息
         $this->error($user->getError());
     } else {
         $list = $user->add($data);
         $id['role_id'] = $this->_post('role_id');
         $id['user_id'] = $list;
         $role = M('roleUser')->add($id);
         $shiyong = M('shiyong');
         $data_id['pid'] = $list;
         $data_id['tsj'] = '143';
         $data_id['xsq'] = '136';
         $slist = $shiyong->add($data_id);
         $testuser = M('testuser');
         $test['pid'] = $list;
         $testlist = $testuser->add($test);
         if ($list and $role and $slist and $testlist) {
             $this->success('注册成功!', U('User/index'));
         } else {
             $this->error('注册失败!');
         }
     }
     /*
     if($data['username']!='' and $data['yourname']!=''){
     	if($pwd==$pwds and $pwd!='' and $pwds!=''){
     				$user = M('user');
     				$data['password'] = md5($pwds);
     				$list=$user->data($data)->add();
     				if($list){
     					$this->success('添加成功','index');
     				}else{
     					$this->error('添加失败,清理联系管理员!');
     				}
     	}else{
     		$this->error('密码有误!!!');
     	}
     }else{
     	$this->error('员工账号和用户姓名不能为空!!!');
     }
     */
 }
开发者ID:sunyang3721,项目名称:tjd-timehr,代码行数:48,代码来源:UserAction.class.php

示例8: shebei_save

 public function shebei_save()
 {
     $data['id'] = $this->_post('id');
     $data['num'] = $this->_post('num');
     $data['home'] = $this->_post('home');
     $data['tsj'] = $this->_post('tsj');
     $data['xsq'] = $this->_post('xsq');
     $shiyong = new UserModel('shiyong');
     if (!$shiyong->create()) {
         $this->error($shiyong->getError());
     } else {
         $list = $shiyong->save($data);
         if ($list) {
             $this->success('修改成功!', U('User/index'));
         } else {
             $this->error('修改失败!');
         }
     }
 }
开发者ID:sunyang3721,项目名称:tjd-timehr,代码行数:19,代码来源:UserAction.class.php

示例9: UserModel

define('ACC', true);
require './include/init.php';
/**
 * regAct.php
 * 接受用户注册的表单信息,完成注册
 * @authors zhangyang (zy1123581321@qq.com)
 * @date    2015-08-09 16:24:11
 */
$user = new UserModel();
$data = $user->_facade($_POST);
$data = $user->_autoFill($data);
/*
 * 需要验证用户名、邮箱、密码等
 */
if (!$user->_validate($_POST)) {
    $msg = implode('<br />', $user->getError());
    include './view/front/msg.html';
    exit;
}
/*
 * 检验用户名是否已存在
 */
if ($user->checkUser($data['username'])) {
    $msg = '用户名已存在';
    include './view/front/msg.html';
    exit;
}
if ($user->reg($data)) {
    $msg = "注册成功";
} else {
    $msg = "注册失败";
开发者ID:KevinZY,项目名称:mall,代码行数:31,代码来源:regAct.php


注:本文中的UserModel::getError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。