Sesión de nodejs

Ejemplos de código

8
0

sesión php

/*Sessions are stored on the server
Sessions are a way to carry data across multiple pages. 
Typically if we set a variable on one page, it wouldn't be available 
on the next page. This is where Sessions come in. Unlike cookies session
data is not stored on the user's computer. It is stored on the server. 
In order to use session variables you have to start a session. 
Every page, that you want to use that data in, you have to use 
session_start.

If you want to unset one of these sessions you can use session_unset

youcan destry the session with session_destroy
*/

<?php if(isset($_POST['submit']))
{ session_start(); // that will start the session
$_SESSION['name'] = htmlentities($_POST['name']);
$_SESSION['email'] = htmlentities($_POST['email']);
header('Location: page2.php'); } ?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Sessions</title>
</head>
<body>
<form method="POST" action="<?php echo $server['PHP_SELF'];?>">
<input type="text" name="name" placeholder="Enter Name">
<br>
<input type="text" name="email" placeholder="Enter Email">
<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
4
0

npm express-sesión

npm i express-session	//On Hyper/CMD

const session = require('express-session');	//To Acquire it

app.use(session({ 		//Usuage
  secret: 'keyboard cat',
  resave: false,
  saveUninitialized: true,
  cookie: { secure: true }
}));
0
0

nodejs compartir sesión

jx mt-keep:5 index
0
0

nodejs compartir sesión

jx install [email protected] --savejx install [email protected] --save

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................