0

応答を出力するために ajax によって呼び出されるページがいくつかあります
。ページは$_SESSION変数を使用するため、session_start(). 時々、ページがセッションデータを消去する(そしてユーザーが切断される)ことに気付きました。私は少し違うものを使用しています session_start()

function sec_session_start() {
    $session_name = 'pentago'; // Set a custom session name
    $secure = false; // Set to true if using https.
    $httponly = false; // This stops javascript being able to access the session id.
    ini_set('session.use_only_cookies', 1); // Forces sessions to only use cookies.
    $cookieParams = session_get_cookie_params(); // Gets current cookies params.
    session_set_cookie_params($cookieParams['lifetime'], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly);
    session_name($session_name); // Sets the session name to the one set above.
    session_start(); // Start the php session
    session_regenerate_id(true); // regenerated the session, delete the old one.
}

私の習慣session_start()に、応答ページがセッションを削除する原因となるものはありますか?

ありがとうございました。

4

0 に答える 0