Home > Backend Development > PHP Tutorial > How to use cookies to save login user names in php, phpcookie_PHP tutorial

How to use cookies to save login user names in php, phpcookie_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:09:01
Original
1111 people have browsed it

How php uses cookies to save login user names, phpcookie

The example in this article describes how PHP uses cookies to save login user names. Share it with everyone for your reference. The details are as follows:

Submit form page

Copy code The code is as follows:
$user = isset($_COOKIE['username'])?$_COOKIE['username']:'';
?>

Username:

Password:

Remember username:


Form information receiving page and set cookie at the same time

Copy code The code is as follows:
$user = $_POST['username'];
if($_POST['rem']){
setcookie("username",$user,time()+3600*3600*24);
}else{
setcookie("username",'',time()-1);
}
echo "Login successful";
?>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/947923.htmlTechArticleHow php uses cookies to save login user names, phpcookie This article describes how php uses cookies to save login user names. . Share it with everyone for your reference. The details are as follows: Submit...
Related labels:
source:php.cn
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