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 :: get_categories not__in 
Php :: password change logout from wordpress 
Php :: give custom field name in laravel form validation error message 
Php :: replace key in php 
Php :: openssl encrypt php with key 
Php :: guzzle http client 
Php :: find which php.ini is used 
Php :: template literals php 
Php :: how to remove array index from json in php 
Php :: combine 2 columns search query laravel 
Php :: wordpress shortcode 
Php :: php return new object 
Php :: php meta refresh 
Php :: array_column in php 
Php :: file upload codeigniter 
Php :: moodle get course image 
Php :: php add element to beginning of associative array 
Php :: check if value change laravel 
Php :: if exists in string php 
Php :: pass image path in laravel blade 
Php :: check date PHP 
Php :: increase php_values 
Php :: laravel read csv file 
Php :: laravel custom validation message 
Php :: laravel collection has 
Php :: laravel carbon created_at date in current month 
Php :: kartik select 2 yii2 
Php :: date_default_timezone_set php bangladesh 
Php :: last_insert_id() php 
Php :: laravel update query builder 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =