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


PHP User::setUsername方法代码示例

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


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

示例1: signupUser

 /**
  * @param Request $request
  * @param Response $response
  */
 public function signupUser(Request $request, Response $response)
 {
     $username = $request->getParam('username');
     $password = $request->getParam('password');
     $email = $request->getParam('email');
     $u = $this->em->getRepository('App\\Model\\User')->findOneBy(array('username' => $username));
     if ($u != []) {
         echo "Username nay da ton tai";
     } else {
         $user = new User();
         $user->setUsername($username);
         $user->setPassword($password);
         $user->setEmail($email);
         $this->em->persist($user);
         $this->em->flush();
         echo "Da them thanh vien moi thanh cong";
     }
 }
开发者ID:hak2c,项目名称:slim-doctrine-mvc,代码行数:22,代码来源:UserController.php

示例2: array

 }
 if ($nation == '' || $nation == null) {
     $app->response->headers->set('Content-Type', 'application/json');
     echo Util::resPonseJson($app, 4000, "nation cannot be null", array());
     exit;
 }
 //     $existeSystemId = $em->createQuery('SELECT u FROM App\Model\User u WHERE u.system_id = '.$systemId);
 $existSystemId = $em->getRepository('App\\Model\\User')->findOneBy(array('system_id' => $systemId));
 if ($existSystemId) {
     $app->response->headers->set('Content-Type', 'application/json');
     echo Util::resPonseJson($app, 4001, "User has existed", array());
     exit;
 }
 $user = new User();
 $user->setSystem_id($systemId);
 $user->setUsername($username);
 $user->setPassword_hash(password_hash($password, PASSWORD_BCRYPT));
 $user->setBirthday(strtotime($birthday));
 $user->setHome_town($home_town);
 $user->setId_number($id_number);
 $user->setNation($nation);
 $user->setPhone($phone);
 $user->setInviter($inviter);
 $user->setSex($sex);
 $user->setStatus(1);
 $user->setCreated_at(time());
 $user->setUpdated_at(time());
 $user->setPayment_password("");
 try {
     $em->persist($user);
     $em->flush();
开发者ID:JefferyWong,项目名称:adapi,代码行数:31,代码来源:auth.php

示例3: createUser

 /**
  * @param string $accessToken
  *
  * @return User
  */
 public function createUser($accessToken)
 {
     $data = $this->getUserData($accessToken);
     $user = new User();
     $user->setLoginProviderUserId($data['id']);
     $user->setLoginProviderName($this->getName());
     $user->setUsername($data['login']);
     if (isset($data['email']) && strlen($data['email']) > 0) {
         $user->setEmail($data['email']);
     }
     return $user;
 }
开发者ID:blazarecki,项目名称:stage1,代码行数:17,代码来源:Provider.php


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