yii2的技巧:
1、读取由页面提交上来的数据
$book = new Books();$post = Yii::$app->request->post();if($book->load($post)){
2、读取已经登陆的用户id
$userid = Yii::$app->session->get('userid');