2
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CakePHP3 で SessionとCookie設定でブラウザ終了後もセッションを継続する方法

Posted at

以下を/config/app.phpに追加する。

php
'Session'                  => [
	'defaults'                => 'database',
	'cookie'                  => 'session', // 任意の文字列
	'timeout'                 => 259200, // 180days
	'cookieTimeout'           => 259200, // 180days
	'autoRegenerate'          => false, // 自動でセッションを再生成するのをやめる
	'checkAgent'              => false, // trueにすると毎回セッションが切れることがある
	'ini'                     => [
		'session.cookie_lifetime' => 15552000, //180days
	],
	'use_cookies'     => 1, // SessionをCookieにも保存する
	'cookie_lifetime' => 15552000//180days
	],

参考

これだとうまくできなかったので

CakePHPでのSessionとCookie設定でブラウザ終了後もセッションを継続する方法

公式情報

2
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?