filmov
tv
PHP:How to create session display and unset session in php

Показать описание
Hello everyone in this tutorial I will show you how
to create session,display session, unset and destroy session
Steps --
1) First create a php page and start the session using the
function
session_start();
2) Then declare and initialize session variables
using the following code.
$_SESSION['name']="Codeeko";
$_SESSION['Age']="19";
3) If you want to add array to a session veriable
use following code
$arr=array(1,2,3,4,5,6,7,8,9,0);
$_SESSION['arrayData']=$arr;
4) Now create another php page and display
the session value;
5) Now create another page and unset session that are
created
6) Now execute that file
7) Now run the file where session value displayed,
if this page shows undefined index error that means
you have unset session.
Thank you for watching this video
to create session,display session, unset and destroy session
Steps --
1) First create a php page and start the session using the
function
session_start();
2) Then declare and initialize session variables
using the following code.
$_SESSION['name']="Codeeko";
$_SESSION['Age']="19";
3) If you want to add array to a session veriable
use following code
$arr=array(1,2,3,4,5,6,7,8,9,0);
$_SESSION['arrayData']=$arr;
4) Now create another php page and display
the session value;
5) Now create another page and unset session that are
created
6) Now execute that file
7) Now run the file where session value displayed,
if this page shows undefined index error that means
you have unset session.
Thank you for watching this video