本文整理匯總了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');
}
}
示例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'] == '兩次輸入密碼不一致');
}
示例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');
}
}
示例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');
}
}
示例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('您輸入的舊密碼不正確');
}
}
示例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');
}
}
示例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('員工賬號和用戶姓名不能為空!!!');
}
*/
}
示例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('修改失敗!');
}
}
}
示例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 = "注冊失敗";