Home >Backend Development >PHP Tutorial >php中经过读取cookie的key值得到其他信息

php中经过读取cookie的key值得到其他信息

WBOY
WBOYOriginal
2016-06-13 11:57:46832browse

php中通过读取cookie的key值得到其他信息
我想加一个修改密码的功能
//设置Cookie
setcookie('UserId', $dataUser->rowid,0, '/');
setcookie('UserName', $dataUser->username,0, '/');  
setcookie('UserType', $dataUser->usertype,0,'/');
setcookie('CorpCode', $dataUser->corpcode,0,'/');
然后怎样通过读取id的值,获得密码,与原密码进行比较。。。。
------解决方案--------------------

<br />$_COOKIE['UserId'];<br />

------解决方案--------------------
看上去没有错误,但是还要经过你自己测试才能知道。
------解决方案--------------------
setcookie('UserId', $dataUser->rowid,0, '/');
$dataUser->passwd=$dataUser->find(array('`passwd`=?',$_COOKIE ["UserID"] ));
数组的键是区分大小写的

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