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 |
Does php class need constructor?
What is the scope of a variable defined in a function?
What is cookies? How to create cookies in php?
What is difference between variable declaration and variable definition?
How does csrf attack work?
How to download the files using PHP
What is a simple php method to make a cross domain data request?
What Is a Persistent Cookie?
What's php?
How to read a file in binary mode?
What are the different ways to login to a remote server? Explain the me, advantages and disadvantages?
What is the use of mysqli_real_escape_string() function?