Home > Backend Development > PHP Tutorial > Introduction to the method of modifying the built-in user table to other tables in Yii2.0

Introduction to the method of modifying the built-in user table to other tables in Yii2.0

巴扎黑
Release: 2023-03-14 17:48:01
Original
1296 people have browsed it

For some reason, I don’t want to use the user table that comes with Yii. I want to use the admin database table I built myself. How to modify it? The editor below will introduce to you how to modify the user table that comes with yii2.0 to other tables. Let’s take a look.

For some reason, I don’t want to use the user table that comes with yii. I want to use my own Create the admin database table and modify it as follows:

1. Refer to common\models\User ModifyAdmin

2 in the advanced template. Modify


'user' => [ 
      //'identityClass' => 'common\models\User', 
      'identityClass' => 'common\models\Admin', 
      'enableAutoLogin' => true,
Copy after login

3 in the configuration file. Modify LoginForm getUser() to get the user from the admin table

The above is the detailed content of Introduction to the method of modifying the built-in user table to other tables in Yii2.0. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template