Home  >  Article  >  Backend Development  >  PHP用cookies自动登录该如何写

PHP用cookies自动登录该如何写

WBOY
WBOYOriginal
2016-06-13 13:16:34715browse

PHP用cookies自动登录该怎么写
初次登录的时候setcookie
第二次登录的时候该怎么进行判断?

------解决方案--------------------
cookie中写个标示符(比如login),比如login,然后在存用户名、密码等东西都存早cookie中,当然这些最好都加密,
if(isset($_COOKIE['login'])){
//读取数据库判断用户名密码是否正确
}
......

Statement:
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