2016-04-30 158 views

回答

0

我創建了個人資料頁面。

控制器代碼:

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; 
相關問題