Home > Backend Development > PHP Tutorial > php cookie read set delete instance_PHP tutorial

php cookie read set delete instance_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 16:54:40
Original
1128 people have browsed it

php cookie read set delete instance The article uses two examples to describe the processing methods of setting cookies, reading cookies and deleting cookies in PHP. If you need to update the cookie to store a new value, just overwrite its original value. Therefore, even if you have just sent a cookie on a previous page, you can still change your name to "jeff".

php tutorial cookie read set delete instance

The article uses two examples to describe the processing methods of setting cookies, reading cookies and deleting cookies in PHP

If you need to update the cookie to store a new value, just overwrite its original value. Therefore, even if you have just sent a cookie on a previous page, you can still change your name to "jeff".
*/

$y2k = mktime(0,0,0,1,1,2000);

setcookie('name', 'jeff', $y2k);


/*
The above is a simple cookie example. Let's look at a complex cookie to use as user login verification example code.
*/

function verify()
{
global $pass;
if($_post['pass'] == $pass || $_cookie['pass'] == md5($pass))
{
Cookie(true);
Return true;
}
else
{
Cookie(false);
Return false;
}
}

function cookie($set = true)
{
global $pass;
if($set)
setcookie("pass",md5($pass),time()+3600);
else
setcookie("pass","",time()-3600);
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631738.htmlTechArticlephp cookie read setting and deletion example article uses two examples to tell about setting cookies and reading cookies in php And cookie deletion and other processing methods. If you need to update the cookie to allow it to be stored...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template