1. Go to this page and download the library: Download myzero1/yii2-log library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
\myzero1\log\components\export\Export::z1logAdd('all', 'user2/update', ['id'=>$model->id], 'create user', sprintf('username:%s', $model->username), ['remark'=>'this is a remark']);
/**
* Creates a new User2 model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new User2();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
\myzero1\log\components\export\Export::z1logAdd('all', 'user2/update', ['id'=>$model->id], 'create user', sprintf('username:%s', $model->username), '');
Yii::$app->getSession()->setFlash('success', '添加成功');
return \myzero1\adminlteiframe\helpers\Tool::redirectParent(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}