Friday , November 8 2024

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

Convert Text To Image

You can convert text to image by using this php code. You then download the image …

Leave a Reply