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


PHP User::getMessages方法代碼示例

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


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

示例1: 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

示例2: registerAction

 public function registerAction()
 {
     $user = new User();
     $data = $this->request->getPost();
     $user->password = isset($data['password']) ? $data['password'] : null;
     $user->retype_password = isset($data['retype_password']) ? $data['retype_password'] : null;
     if ($user->save($data)) {
         if ($this->getUser()->login($user->email, $user->password)) {
             return $this->redirect('account/index');
         } else {
             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,項目名稱:itm-phalcon-project,代碼行數:20,代碼來源:SignupController.php

示例3: addAction

 public function addAction()
 {
     $formData = [];
     if ($this->request->isPost()) {
         if ($this->security->checkToken()) {
             $formData = $this->request->getPost();
             $userModel = new User();
             $userModel->name = $formData['name'];
             $userModel->email = $formData['email'];
             $userModel->password = $this->security->hash($formData['password']);
             $userModel->gender = $formData['gender'];
             $userModel->role = $formData['role'];
             $userModel->status = $formData['status'];
             if ($userModel->create()) {
                 $formData = [];
                 $this->flash->success('Add user successfully');
             } else {
                 $this->flash->outputMessage('error', $userModel->getMessages());
             }
         }
     }
     $this->view->setVars(['formData' => $formData, 'roles' => User::$roles, 'status' => User::$statusName]);
     $this->tag->prependTitle('Add user');
 }
開發者ID:phannguyenvn,項目名稱:test-git,代碼行數:24,代碼來源:UserController.php


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