I have tested php sessions with this function
session_start();
$_SESSION['test'][] = time();
header('Content-type: text/plain');
print_r($_SESSION);
In theory, it should return one more array element each time I reload the page. But in my case, for some reason, it always displays a single element.
So I'm stuck, please help!
UPDATED
PHP version on my server is 5.3.13 Here is what i have in session section
Using ajax you can call a php script that refreshes your session every 10 minutes. :) This is as far as i can go to "exact". <? php session_start(); // store session data if (isset($_SESSION['id'])) $_SESSION['id'] = $_SESSION['id']; // or if you have any algo. ?>
A session is a way to store information (in variables) to be used across multiple pages. Unlike a cookie, the information is not stored on the users computer.
Starting a PHP Session A PHP session is easily started by making a call to the session_start() function. This function first checks if a session is already started and if none is started then it starts one. It is recommended to put the call to session_start() at the beginning of the page.
A workaround to try...
session_start();
if(isset($_SESSION['test'])){
array_push($_SESSION['test'], time());}
else {
$_SESSION['test']= time();}
header('Content-type: text/plain');
print_r($_SESSION);
If this doesn't work as well...then you may not have cookies enabled...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With