Saturday , November 17 2018
Home / PHP / How can start session in php ?

How can start session in php ?

A session in php is started using session_start() function.
Globle variables (eg. $_SESSION.) are used for session variables.
Now we create a page “example_session.php” and start a session with some session variables :

Example 

<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>

<?php
// Set session variables
$_SESSION[“country”] = “India”;
$_SESSION[“animal”] = “cat”;
echo “Session variables are set.”;
?>

</body>

About admin

Check Also

Resize Images in php

Creating thumbnails of the images is required many a times, this code will be useful ...

Leave a Reply