No dudes en divulgar nuestro sitio y códigos con otro, ayúdanos a hacer crecer esta comunidad.
Ejemplo 1: cookies php
//Cookies
//Cookies are stored on the client side. cookies are not as secure as sessions
//and it is recommended that you use sessions as much as possible.
//save addional information as an array in a cookie
$user=['name'=>'Brad','email'=>'[email protected]','age'=35];$user=serialize($user);setcookie('user',$user,time()+(86400*30));$user=unserialize($_COOKIE['user']);echo$user['name'];
Ejemplo 2: cookies php
//Cookies
//Cookies are stored on the client side. cookies are not as secure as sessions
//and it is recommended that you use sessions as much as possible.
if(isset($_POST['submit']))$username=htmlentities($_POST['username']);setcookie('nameofcookie',$username,time()+3600);//1hour time limitheader('Location: page2.php');?>DOCTYPEhtml><html><head><title>PHP Cookiestitle>head><body><formmethod="POST"action="echo$_SERVER['PHP_SELF'];?>"><inputtype="text"name="username"placeholder="Enter Username"><br><inputtype="submit"name="submit"value="Submit">form>div>body>html>
Reseñas y calificaciones de la guía
Si crees que te ha sido de utilidad nuestro artículo, sería de mucha ayuda si lo compartes con el resto programadores y nos ayudes a difundir esta información.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)