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']:'';
?>
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.
http://www.bkjia.com/PHPjc/947923.htmlwww.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...