Skip to content

Instantly share code, notes, and snippets.

@fedealvz
Last active September 7, 2023 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedealvz/21404a6c6ba3efe7635c0ff85921b43d to your computer and use it in GitHub Desktop.
Save fedealvz/21404a6c6ba3efe7635c0ff85921b43d to your computer and use it in GitHub Desktop.
Prueba de sesiones #session #PHP
<?php
// Más información: https://help.wnpower.com/hc/es/articles/19296028017677
// Forzar mostrar errores en pantalla
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
if (isset($_SESSION['PRUEBA'])) {
$valor=$_SESSION['PRUEBA'];
echo "<br>Session ID: ".session_id();
echo "<br>Valor de la variable guardada en la Session: ".$valor;
} else {
echo "<br>Session no disponible. Haz <a href='?reload=true'>reload</a> para iniciar el testeo.";
$_SESSION['PRUEBA']="Hola Mundo!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment