diff --git a/config/web.php b/config/web.php index 2d8363717..1a02bd555 100644 --- a/config/web.php +++ b/config/web.php @@ -69,6 +69,17 @@ 'standing/' => '/contest/standing2' ], ], + 'session' => [ + 'class' => 'yii\web\DbSession', + // Set the following if you want to use DB component other than + // default 'db'. + // 'db' => 'mydb', + // To override default session table, set the following + // 'sessionTable' => 'my_session', + ], + 'security' => [ + 'passwordHashCost' => 10, // 尝试调整这个值 + ], ], 'params' => $params, ]; diff --git a/migrations/m241114_082321_create_session.php b/migrations/m241114_082321_create_session.php new file mode 100644 index 000000000..7347f9003 --- /dev/null +++ b/migrations/m241114_082321_create_session.php @@ -0,0 +1,45 @@ +createTable('session', [ + 'id' => $this->char(40)->notNull(), + 'expire' => $this->integer(), + 'data' => $this->binary(), + ]); + $this->addPrimaryKey('pk_session_id', 'session', 'id'); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropTable('session'); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m241114_082321_create_session cannot be reverted.\n"; + + return false; + } + */ +}