Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to create cookie in php

// SYNTAX
//setcookie(name, value, expire, path, domain, secure, httponly);
$cookie_name = "LoginUser";
$cookie_value = "ex@gmail.com";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
if(!isset($_COOKIE[$cookie_name])) {
  echo "Cookie '" . $cookie_name . "' is not set!";
} else {
  echo "Cookie '" . $cookie_name . "' is set!<br>";
  echo "Value is: " . $_COOKIE[$cookie_name];
}
// FOR UNSET COOCKIE
 unset($_COOKIE['LoginUser']);
Comment

hoew to store a cookie php

<?php
$expireDate = time()+2*24*60*60;
setcookie("Auction_Item", "Luxury Car", $expireDate);
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php isarray 
Php :: php artisan clear 
Php :: php replace space with dash 
Php :: laravel model string primary key 
Php :: laravel run migration 
Php :: wordpress disallow_file_edit 
Php :: background image in laravel blade 
Php :: php 3 digit decimal 
Php :: php encode url parameters 
Php :: blade loop last 
Php :: php form action self 
Php :: path of app directory in controller laravel 
Php :: php multidimensional array search by value 
Php :: array_unique 
Php :: 500 server error laravel 
Php :: remove phpmyadmin ubuntu 20.04 completely 
Php :: styling not working in laravel breeze 
Php :: validate year laravel 
Php :: current time in laravel migration 
Php :: set charset of response php 
Php :: php mysql date 
Php :: boolean to string php 
Php :: php date and time 
Php :: laravel time format 
Php :: woocommerce terms and condition fields checked by default 
Php :: codeigniter 3 insert 
Php :: default port for laravel 
Php :: wordpress thumbnail url 
Php :: php word wrap 
Php :: if null blade laravel 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =