0
Q:

session start php

<?php 
  // Start the session
  session_start();
?>
<!DOCTYPE html>
<html>
  <body>
  <?php
    // Set session variables
    $_SESSION["color"]= "blue";
    $_SESSION["animal"]= "dog";
    echo "The session variable are set up.";
  ?>
  </body>
</html>
5
session_start();
if(!isset($_SESSION["started"]){ //Check if the session already exist
    //If it does not exist we append attributes we need in
	$_SESSION["started"] = true;
  	$_SESSION["attribute_1"] = $value_1;  
  	...
    $_SESSION["attribute_n"] = $value_n;      
}
1
<?php 
  // Start the session
  session_start();

  // Set session variables
  $_SESSION["color"]= "blue";
  $_SESSION["animal"]= "dog";
  echo "The session variable are set up.";
?>
0

<?php
// This sends a persistent cookie that lasts a day.
session_start([
    'cookie_lifetime' => 86400,
]);
?>

0

New to Communities?

Join the community