如何从数据库为登录用户创建配置文件?

How to create profile for logged in users from the database?

我在 yii2 basic 下工作我用数据库创建了登录表单我想显示数据库中登录用户的详细信息。

请帮助我。

提前致谢。

我创建了个人资料页面。

控制器代码:

public function actionProfile1()
{
    //if (isset($_POST['formdata'])) {

    $employee_id=$_POST['employee_id'];
    $employee_name=$_POST['employee_name'];
    $email_id=$_POST['email_id'];

    $joining_date=$_POST['joining_date'];
    $joining=  date('d-M-Y',strtotime($joining_date));
    $confirmation_date=$_POST['confirmation_date'];
    $relieving_date=$_POST['relieving_date'];
    Yii::$app->db->createCommand("UPDATE Employee SET Name='$employee_name', Email_id='$email_id 'where Employee_id='$employee_id' ")->execute();

    $model = new Employee();
    $query = Employee::find()->all();
    Yii::$app->session->setFlash('success', 'Updated Successfully');
    return $this->render('profile', [
        'model' => $model,
        'Employee' => $query,
    ]); 
}

并在视图中添加以识别用户:

Yii::$app->user->identity->Email_id;