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


PHP Users::findByUsername方法代码示例

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


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

示例1: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = Users::findByUsername($this->username);
     }
     return $this->_user;
 }
开发者ID:Junaid-Farid,项目名称:olc,代码行数:12,代码来源:LoginForm.php

示例2: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         $this->_user = Users::findByUsername($this->username);
     }
     return $this->_user;
 }
开发者ID:ewwgit,项目名称:eptri,代码行数:12,代码来源:LoginForms.php

示例3: actionAuthenticate

 public function actionAuthenticate()
 {
     $request = Yii::$app->request;
     $username = $request->post('username');
     $user = Users::findByUsername($username);
     // Just create the user if not found
     if (!$user) {
         $user = new Users();
         $user->username = $username;
         $user->save();
     }
     echo json_encode(['auth' => $user->getId() ? true : false, 'id' => $user->id, 'username' => $user->username]);
 }
开发者ID:atymchuk,项目名称:test-skyeng,代码行数:13,代码来源:AuthController.php

示例4: actionGetScore

 public function actionGetScore()
 {
     $request = Yii::$app->request;
     $username = $request->post('username');
     $testId = $request->post('testId');
     $user = Users::findByUsername($username);
     $test = Test::findOne($testId);
     if (!$user || !$test) {
         return ['success' => false, 'message' => 'Eiher the user or test was not found'];
     }
     return ['success' => true, 'score' => $test->score];
 }
开发者ID:atymchuk,项目名称:test-skyeng,代码行数:12,代码来源:TestController.php

示例5: getBaseUrl

});
Uploads::applyFilter('save', function ($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
    if (!$params['entity']->id) {
        $params['entity']->created = date('Y-m-d H:i:s');
    }
    return $chain->next($self, $params, $chain);
});
use lithium\util\Validator;
Validator::add('usernameTaken', function ($value) {
    $success = false;
    if (strlen($value) != 0) {
        $success = count(Users::findByUsername($value)) == 0 ? false : true;
    }
    return !$success;
});
use lithium\core\Libraries;
Libraries::add('upload', array('path' => LITHIUM_APP_PATH . '/libraries/_source/upload/'));
Libraries::add('captcha', array('path' => LITHIUM_APP_PATH . '/libraries/_source/captcha/', 'webroot' => LITHIUM_APP_PATH . '/libraries/_source/captcha/', "bootstrap" => "securimage.php"));
define('_INSTALL', file_exists($_SERVER['DOCUMENT_ROOT'] . "/install") ? '1' : '0');
function getBaseUrl()
{
    $protocol = isset($_SERVER["HTTPS"]) && $_SERVER['HTTPS'] != "off" ? "https" : "http";
    return $protocol . "://" . $_SERVER['HTTP_HOST'];
}
use lithium\core\Environment;
Environment::is(function ($request) {
    return in_array($request->env('SERVER_ADDR'), array('::1', '127.0.0.1')) ? 'development' : 'production';
开发者ID:romainwurtz,项目名称:Li3Press,代码行数:31,代码来源:custom.php


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