- #1
- 4,652
- 38
I'm a little confused about how PHP's session_start() function works.
There's a tutorial I am reading here: http://www.tizag.com/phpT/phpsessions.php
Here's an example they give of a counter script:
It seems like every time I call this PHP script from a new page, a new session will start, because the first line is:
session_start();
Does PHP ignore this function if a session exists?
Thanks.
There's a tutorial I am reading here: http://www.tizag.com/phpT/phpsessions.php
Here's an example they give of a counter script:
Code:
<?php
session_start();
if(isset($_SESSION['views']))
$_SESSION['views'] = $_SESSION['views']+ 1;
else
$_SESSION['views'] = 1;
echo "views = ". $_SESSION['views'];
?>
It seems like every time I call this PHP script from a new page, a new session will start, because the first line is:
session_start();
Does PHP ignore this function if a session exists?
Thanks.