本文整理汇总了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]);
}
}
}
示例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]);
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
示例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);
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}