How can we know that a session is started or not?
Answers were Sorted based on User's Feedback
Answer / deep
we'll have to set a session variable after starting a
session as shown below
--------------------------------------------------
<?php
session_start();
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo "Views=". $_SESSION['views'];
?>
--------------------------------------------------
it will set as well as increment the session variable
or we may simply echo a value to check whether a session is
started or not.
| Is This Answer Correct ? | 10 Yes | 0 No |
Answer / rahul
on head of the page we have to write
session_start();
statement.
| Is This Answer Correct ? | 3 Yes | 9 No |
Answer / kamlesh
we can check is_session_start() by this function.
| Is This Answer Correct ? | 3 Yes | 9 No |
What are traits? How is it used in php?
How can i change the extension name like i have a page which name aboutme.php but i want to show it aboutme.php3 or aboutme.aspx?
How do you register one session ?
What is the meaning of curl , which is used while connecting with pay pal? and how it works?
my english is not too good then what we apply for a php programer post
Where are sessions stored php?
What is php ci?
What is curl php?
What is the super method?
Who is the father of PHP and explain the changes in PHP versions?
13 Answers Befree, iMark Group, Netizen,
Which function can be used to exit from the script after displaying the error message?
What is call by reference in php?