成功登录后,我正在保存会话变量。
当用户转到应用程序中的不同页面时,即使我没有明确销毁会话,会话也会消失。我该如何解决?
这是会话似乎消失的页面。
<?php
include 'core/init.php';
include 'core/sendmessage.php';
$user_info = $_SESSION['user_id'];
$getUser = mysql_query("SELECT * FROM users WHERE user_id = ".$uid);
$user_info = array();
while($currentRow = mysql_fetch_array($getUser)){
$user_info['firstname'] = $currentRow['first_name'];
$user_info['lastname'] = $currentRow['last_name'];
$user_info['username'] = $currentRow['username'];
}
?>
在core/init.php
我有会话开始方法。
<?php
session_start();
require 'database/connect.php';
require 'functions/users.php';
require 'functions/general.php';
if (logged_in() === true) {
$user_data = user_data($_SESSION['user_id'],'first_name','last_name','username');
}
$errors = array();
?>