1

This is more of a conceptual question. But I was wondering when a web session starts and ends when using PHP. I'm pretty sure the session starts when the user first requests any page that has the session_start() function. But does the session end when the user navigates to another page in the same tab? Is the same session preserved across multiple tabs and windows of the same browser? To preserve a session after the browser closes, do you have to use cookies?

4

1 に答える 1

0
  1. セッションは最初から始まりますsession_start()
  2. session.gc_maxlifetimeセッションは、PHP のセッション ガベージ コレクターに関連する、および/またはその他の処理の後に終了session.cookie_lifetimeします。
  3. セッションを使用するには Cookie が必要です。これは、PHP がユーザーの SESSID を含む Cookie を設定し、ブラウザーが要求ごとにそれを自動的に送り返すためです。
    • この Cookie を削除すると、セッションへのアクセスが取り消されますが、技術的には、タイムアウトが期限切れになり、ガベージ コレクターが実行されるまで、セッション データは引き続き存在します。

参照

于 2013-09-26T23:28:20.547 に答える