setcookie php
setcookie($cookiename, $cookievalue, time() + (86400 * 30), "/"); // 86400 = 1 day
setcookie php
setcookie($cookiename, $cookievalue, time() + (86400 * 30), "/"); // 86400 = 1 day
how to set cookie expire time in php
HOW TO SET COOKIES: (to store small pieces of data in CLIENTS browser)
DESCRIPTION:
setcookie(string $name, string $value = "", int $expires = 0 (no expiry) ): bool
EXAMPLE:
$value = 'something from somewhere';
setcookie("TestCookie", $value); // default no expiry
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
// Print an individual cookie value- $_COOKIE["Cookie Key Name"];
echo $_COOKIE["TestCookie"];
// View all cookies
print_r($_COOKIE);
FULL PARAMETER OPTIONS:
setcookie(
string $name,
string $value = "",
int $expires = 0,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
): bool
EXAMPLE:
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us