當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::save方法代碼示例

本文整理匯總了PHP中models\User::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::save方法的具體用法?PHP User::save怎麽用?PHP User::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models\User的用法示例。


在下文中一共展示了User::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionEdit_status

 public function actionEdit_status()
 {
     $user = new User();
     $user->find()->where(['id' => $_POST['userID']])->one();
     $user->status = $_POST['status'];
     $user->save();
 }
開發者ID:apuc,項目名稱:app_to_vk,代碼行數:7,代碼來源:Admin.php

示例2: actionSave_profile

 public function actionSave_profile()
 {
     if (isset($_POST['saveProfile'])) {
         $user = new User();
         $usServ = new UserServices();
         $vk_id = Cookie::get('vk_id');
         $user->find()->where(['vk_id' => $vk_id])->one();
         $usServ->deleteByField('user_id', $user->id);
         $user->region_id = $_POST['region_id'];
         $user->city_id = $_POST['city_id'];
         $user->email = $_POST['email'];
         $user->phone = $_POST['phone'];
         $user->link = $_POST['link'];
         $user->save();
         foreach ($_POST['services'] as $serv) {
             $usServ = new UserServices();
             $usServ->user_id = $user->id;
             $usServ->service_id = $serv;
             $usServ->save();
         }
         header('Location: /vk2/office/my', true, 302);
     } else {
         Header::redirect('/vk2/profile/my', true, 302);
     }
 }
開發者ID:apuc,項目名稱:app_to_vk,代碼行數:25,代碼來源:Profile.php

示例3: create

 protected function create()
 {
     $params = arrayKeysSnakeToCamel($_POST['user']);
     $user = new User();
     $user->fromArray($params);
     $user->save();
     $this->addFlash("success", "registered");
     redirectTo("/");
 }
開發者ID:OneTimeCZ,項目名稱:Tasker,代碼行數:9,代碼來源:UserController.php

示例4: register

 public static function register($email, $nick, $password)
 {
     $user = new User();
     $user->email = $email;
     $user->nick = $nick;
     $user->password = password_hash($password, PASSWORD_DEFAULT);
     $user->save();
     return $_SESSION['user'] = $user->id;
 }
開發者ID:fant0m,項目名稱:VAII,代碼行數:9,代碼來源:Auth.php

示例5: actionCreate

 public function actionCreate()
 {
     $user = new User();
     $user->scenario = 'create';
     if (isset($_POST['User']) && is_array($_POST['User']) && $user->load($_POST['User']) && $user->save()) {
         $this->redirect(['site/index']);
     }
     $this->render('create', ['user' => $user]);
 }
開發者ID:VlPetukhov,項目名稱:summa.local,代碼行數:9,代碼來源:UserController.php

示例6: actionReg

 public function actionReg()
 {
     $vk_id = $this->app->cookie->get('vk_id');
     $user = new User();
     $user->find()->where(['vk_id' => $vk_id])->one();
     $user->status = $_GET['status'] == 1 ? 2 : 1;
     $user->save();
     $this->app->parser->render('profile', ['user' => $user]);
 }
開發者ID:apuc,項目名稱:My_Framework,代碼行數:9,代碼來源:Auth.php

示例7: actionMy

 public function actionMy()
 {
     $vk_id = Cookie::get('vk_id');
     $user = new User();
     $user->find()->where(['vk_id' => $vk_id])->one();
     $user->status = $_GET['status'] == 1 ? 2 : 1;
     $user->save();
     $region = new GeobaseRegion();
     $city = new GeobaseCity();
     $regionAll = $region->find()->orderBy('name', 'ASC')->all();
     $this->app->parser->render('profile', ['user' => $user, 'regionAll' => $regionAll]);
 }
開發者ID:apuc,項目名稱:My_Framework,代碼行數:12,代碼來源:Profile.php

示例8: registerUser

 function registerUser($postdata)
 {
     $regname = htmlentities($postdata['regname']);
     $regpass = htmlentities($postdata['regpass']);
     $regauth = htmlentities($postdata['regauth']);
     $regpass = hash('sha256', $regpass);
     $user = new User();
     $user->setName($regname);
     $user->setPassword($regpass);
     $user->setAuthlevel($regauth);
     $user->save();
 }
開發者ID:kowi90,項目名稱:mvc_test,代碼行數:12,代碼來源:Register.php

示例9: actionReg

 public function actionReg()
 {
     $vk_id = Cookie::get('vk_id');
     $user = new User();
     $user->find()->where(['vk_id' => $vk_id])->one();
     $user->status = $_GET['status'] == 1 ? 2 : 1;
     $user->save();
     Header::redirect('/vk2/profile/my', true, 302);
     /*$this->app->parser->render('profile',
       [
           'user' =>$user,
       ]);*/
 }
開發者ID:apuc,項目名稱:app_to_vk,代碼行數:13,代碼來源:Auth.php

示例10: create_new_account

 /**
  * Creates a New account
  * @param 	Request object - which contains email, password etc
  *
  * @return Nothing
  */
 public function create_new_account(Application $app, Request $request)
 {
     $email = $request->get('email');
     $password = $app->escape($request->get('password'));
     $confirm_password = $request->get('confirm_password');
     $user = new User($app);
     try {
         $user->save('user', array('email' => $email, 'password' => md5($password), 'create_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")));
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
     return $app->render('tweets.php.twig', array('error_message' => '', 'tweets' => []));
 }
開發者ID:hupadhyayula,項目名稱:twitter,代碼行數:19,代碼來源:UserController.php

示例11: registerAction

 public function registerAction()
 {
     $user = new User();
     $success = $user->save($this->request->getPost());
     if ($success) {
         return $this->redirect('signin/index');
     } else {
         echo 'Sorry, the following problems were generated: ';
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), '<br/>';
         }
     }
     $this->view->disable();
 }
開發者ID:remk-wadriga,項目名稱:phalcon-base-application-project,代碼行數:14,代碼來源:SignupController.php

示例12: postRegister

 public function postRegister(Request $request)
 {
     $validator = Validator::make($request->all(), ['login' => 'required|min:4|max:25|unique:user,login', 'pseudo' => 'required|min:4|max:25|unique:user,pseudo', 'password' => 'required|min:6|max:20|confirmed', 'email' => 'required|max:100|email|unique:user,email']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator->errors())->withInput();
     }
     $u = new User();
     $u->login = $request->input('login');
     $u->pseudo = $request->input('pseudo');
     $u->email = $request->input('email');
     $u->password = Hash::make($request->input('password'));
     $u->streaming = 0;
     $u->save();
     return redirect(route('getLogin'));
 }
開發者ID:quentin-sommer,項目名稱:WebTv,代碼行數:15,代碼來源:UserController.php

示例13: registerAction

 public function registerAction()
 {
     if (F::$app->getRequest()->getIsPost()) {
         $item = new User();
         $item->username = $_POST['username'];
         $item->password = $_POST['password'];
         $item->repassword = $_POST['repassword'];
         $item->date_created = time();
         if ($item->save()) {
             return "User was registered";
         } else {
             return "User was not registered";
         }
     }
     return $this->render('register');
 }
開發者ID:pauk2012,項目名稱:test_desk,代碼行數:16,代碼來源:Users.php

示例14: register

 public function register()
 {
     if (isset($_POST['login'])) {
         $this->redirect('users', 'login');
         exit;
     }
     if (isset($_POST['register'])) {
         $username = $_POST['username'];
         $email = $_POST['email'];
         $password = $_POST['password'];
         $confirm = $_POST['confirm'];
         if ($username == null) {
             echo 'Enter Valid Username!';
             die;
         }
         if ($email == null) {
             echo 'Enter email!';
             die;
         }
         if ($password == null) {
             echo 'Enter password!';
             die;
         }
         if ($confirm == null) {
             echo 'Confirm password!';
             die;
         }
         if ($_POST['password'] != $_POST['confirm']) {
             echo 'Confirm password and password are not the same!';
             die;
         }
         $user = new User($username, $password, $email);
         $user->save();
         $userInstance = UserRepository::create()->getByName($username);
         $newUserId = intval($userInstance['id']);
         var_dump($userInstance);
         if ($userInstance) {
             CartRepository::create()->newCart($newUserId);
         }
         $this->redirect('users', 'login');
     }
 }
開發者ID:BarishYumerov,項目名稱:PHP,代碼行數:42,代碼來源:UsersController.php

示例15: updateUser

 /**
  * Update the given user.
  *
  * @param Users $user
  *        	The user to update
  * @param array $data
  *        	an array that contains the following fields :<pre>
  *        	name
  *        	email
  *        	password
  *        	</pre>
  * @return boolean true if there is nothing to update or updating was done successfully, false otherwise.
  *        
  */
 public static function updateUser(User $user, $data = array())
 {
     if (!$user instanceof User) {
         return false;
     }
     $needsUpdate = false;
     if (isset($data['name'])) {
         $user->display_name = $data['display_name'];
         $needsUpdate = true;
     }
     if (isset($data['password'])) {
         $user->password = Hash::make($data['password']);
         $needsUpdate = true;
     }
     if ($needsUpdate) {
         return $user->save();
     } else {
         return true;
     }
 }
開發者ID:ashajjar,項目名稱:mock-aop,代碼行數:34,代碼來源:User.php


注:本文中的models\User::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。