/**
* 记住密码/清空密码
*
* @param $account 登录的账号
* @param $pwd 登录的密码
* @param $name 缓存名称
* @param
t
y
p
e
1
记
住
0
清
空
∗
/
p
u
b
l
i
c
f
u
n
c
t
i
o
n
S
e
t
P
a
s
s
w
o
r
d
(
type 1记住 0清空 */ public function SetPassword(
type1记住0清空∗/publicfunctionSetPassword(account, $pwd , $name, KaTeX parse error: Expected '}', got 'EOF' at end of input: …0){ if(type == 1) {
$data = array(
‘phone’ => $account,
‘pwd’ => $pwd
);
k
e
y
=
b
a
s
e
6
4
e
n
c
o
d
e
(
j
s
o
n
e
n
c
o
d
e
(
key = base64_encode(json_encode(
key=base64encode(jsonencode(data));
setcookie($name, KaTeX parse error: Expected 'EOF', got '}' at position 58: …true); }̲else{ …name,’’ , time() - 3600 * 24 * 30, ‘/’, ‘’, ‘’, true);
}
}
/**
* 得到保存的密码
* @param $name
* @return mixed
*/
public function GetPassword($name){
$info = array();
if(!isset($_COOKIE[$name])){
$data['errorCode'] = 1;
}else{
if($_COOKIE[$name] == ''){
$data['errorCode'] = 1;
}else{
$key = json_decode(base64_decode($_COOKIE[$name], true),true);
if(!is_array($key)){
$data['errorCode'] = 1;
}else{
$data['errorCode'] = 0;
$info['phone'] = $key['phone'];
$info['pwd'] = $key['pwd'];
$info['type'] = 1;
}
}
}
if($data['errorCode'] == 1){
$info['phone'] = '';
$info['pwd'] = '';
$info['type'] = 0;
}
return $info;
}