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


PHP Users::load方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new Users model.
  * For ajax request will return json object
  * and for non-ajax request if creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $request = Yii::$app->request;
     $model = new Users();
     if ($request->isAjax) {
         /*
          *   Process for ajax request
          */
         Yii::$app->response->format = Response::FORMAT_JSON;
         if ($request->isGet) {
             return ['title' => "Create new Users", 'content' => $this->renderPartial('create', ['model' => $model]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
         } else {
             if ($model->load($request->post()) && $model->save()) {
                 return ['forceReload' => 'true', 'title' => "Create new Users", 'content' => '<span class="text-success">Create Users success</span>', 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::a('Create More', ['create'], ['class' => 'btn btn-primary', 'role' => 'modal-remote'])];
             } else {
                 return ['title' => "Create new Users", 'content' => $this->renderPartial('create', ['model' => $model]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
             }
         }
     } else {
         /*
          *   Process for non-ajax request
          */
         if ($model->load($request->post()) && $model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('create', ['model' => $model]);
         }
     }
 }
开发者ID:alfredosotil,项目名称:swinnapp,代码行数:35,代码来源:UsersController.php

示例2: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     $model->setScenario('register');
     $post = Yii::$app->request->post();
     $formName = basename($model->className());
     if ($model->load($post)) {
         // Default value
         $model->is_super_admin = isset($post[$formName]['is_super_admin']) ? $post[$formName]['is_super_admin'] : 0;
         $model->role = $model->is_super_admin ? Identity::ROLE_SUPERADMIN : 30;
         $model->fecha_conexion = isset($post[$formName]['fecha_conexion']) ? $post[$formName]['fecha_conexion'] : Yii::$app->fn->GetDate('none');
         $model->fecha_modif = isset($post[$formName]['fecha_modif']) ? $post[$formName]['fecha_modif'] : Yii::$app->fn->GetDate('none');
         $model->fecha_registro = isset($post[$formName]['fecha_registro']) ? $post[$formName]['fecha_registro'] : Yii::$app->fn->GetDate();
         $model->id_estado = isset($post[$formName]['id_estado']) ? $post[$formName]['id_estado'] : 1;
         if ($model->validate()) {
             $model->setPassword();
             $model->generateAuthKey();
             if ($model->save()) {
                 return $this->redirect(['view', 'id' => $model->id]);
             }
         }
     }
     // Load empty/error form
     return $this->render('create', ['model' => $model]);
 }
开发者ID:juanchi008,项目名称:playa_auto,代码行数:30,代码来源:UsersController.php

示例3: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->user . id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:Herklos,项目名称:Your-Corp,代码行数:14,代码来源:UserController.php

示例4: actionRegistration

 public function actionRegistration()
 {
     $model = new Users();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['site/index']);
     } else {
         return $this->render('registration', ['model' => $model]);
     }
 }
开发者ID:egrubbi,项目名称:project,代码行数:9,代码来源:UsersController.php

示例5: actionRegister

 public function actionRegister()
 {
     $model = new Users();
     $model->load(Yii::$app->request->post());
     if ($model->validate()) {
         $model->save();
         return $this->render('confirm', ['model' => $model]);
     }
     return $this->render('register', ['model' => $model]);
 }
开发者ID:smackmybitchup,项目名称:yii2project,代码行数:10,代码来源:JopaController.php

示例6: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users(['scenario' => 'login']);
     //        $model = new Users(['scenario' =>'login']);
     //        error_log(print_r($model,1));
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:lipengyihao,项目名称:yii2-basic-advanced,代码行数:16,代码来源:UsersController.php

示例7: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     //$model->password=sha1($model->attributes['password']);
     //print_r(Yii::$app->request->post());
     if ($model->load(Yii::$app->request->post()) && $model->save(false)) {
         return $this->redirect(['view', 'id' => $model->user_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:Junaid-Farid,项目名称:olc,代码行数:16,代码来源:UsersController.php

示例8: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     if ($model->load(Yii::$app->request->post())) {
         $model->password = md5($model->password);
         $model->save();
         return $this->redirect(['users/index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:jibendi,项目名称:shinda2,代码行数:16,代码来源:UsersController.php

示例9: actionIndex

 public function actionIndex()
 {
     $model = new app\models\Users();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             // form inputs are valid, do something here
             return;
         }
     }
     return $this->render('form1', ['model' => $model]);
 }
开发者ID:fran242,项目名称:Yii2-2,代码行数:11,代码来源:Form1Controller.php

示例10: actionRegister

 public function actionRegister()
 {
     $model = new Users();
     $result = ['model' => $model];
     if (\Yii::$app->request->isPost) {
         $post = \Yii::$app->request->post();
         if ($model->load($post) && $model->validate()) {
             echo '注册成功';
         }
     }
     return $this->render('register', $result);
 }
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:12,代码来源:PublicController.php

示例11: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param bool $index
  * @param null|integer $project_id
  * @return mixed
  */
 public function actionCreate($index = false, $project_id = false)
 {
     $model = new Users();
     if ($project_id) {
         $model->project_id = $project_id;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $index ? $this->redirect(['/admin/index/user', 'id' => $model->id]) : $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:CyanoFresh,项目名称:SelectPhoto,代码行数:19,代码来源:UsersController.php

示例12: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     if ($model->load(Yii::$app->request->post())) {
         $model->login = md5($model->rem_login);
         $model->password = md5($model->rem_pas);
         $model->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:bxgsmart,项目名称:korsun-yii2-web-monitoring,代码行数:17,代码来源:UsersController.php

示例13: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     if ($model->load(Yii::$app->request->post())) {
         $salt = uniqid('', true);
         $model->password = sha1($model->password . $salt);
         $model->salt = $salt;
         if ($model->save()) {
             return $this->redirect(['index']);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:ceif,项目名称:Autarquia-Livre,代码行数:19,代码来源:UsersController.php

示例14: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $success = false;
     $model = new Users();
     if ($model->load(Yii::$app->request->post())) {
         $model->Password = md5($model->Password);
         if ($model->save()) {
             $success = true;
         }
     }
     if ($success) {
         return $this->redirect(['view', 'id' => $model->UserID]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:raguila,项目名称:islc,代码行数:21,代码来源:UsersController.php

示例15: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     if ($model->load(Yii::$app->request->post())) {
         $model->username = $model->id;
         $model->password = 'ltl333';
         if ($model->validate()) {
             $model->save();
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('create', ['model' => $model]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:PichurChill,项目名称:sues_print,代码行数:21,代码来源:UserController.php


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