2020年6月23日 PHPでcookie処理を組んでいた時に、次のような現象が発生しました。 cookieに情報を保存した状態で、同じサーバー内の別ページにジャンプしたところ、保存したcookieの情報が消えてしまいました。 正確には、cookieの情報が消えたり消えなかったりです。 ただ、消えては困る処理だったので、原因を調べて対処いたしました。 忘備録として記録いたします。 COOKIEとは(概略) そもそもcookieとは何か? ということを解説いたします。 PHPは起動と終了がその都度行われる言語です。 そのため、一時的なパラメータ(一時的な情報)を保持することができません。 例えば、改ページ処理や別ページにジャンプすると、その都度一時的に取得した情報はリセットされます。 これをなんとかする方法としてcookieを使用します。 一時的な情報をcookieに保存して、次の起動時にc