1
0

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 1 year has passed since last update.

PHP cookies 更新と反映

Last updated at Posted at 2022-02-21

$_COOKIEはブラウザ上に保存された情報を読み込む。

setcookie関数で情報を更新する際は更新される予定の情報がまだブラウザ上に保存されていない(これから保存される。)
よってsetcookie関数が情報を更新する際に$_COOKIEが読み込む情報はこれまでに既に保存されている更新前のcookie情報となる。
上記がsetcookie関数による情報の更新が$_COOKIEに反映されるのにワンアクション遅れる理由。

1
0
0

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?