//加密 function encrypt($data) { $key = md5("safregr"); $str = base64_encode($data); $res = base64_encode($str.$key); return $res; } //解密 function decrypt($data) { $key = md5("safregr"); $data = base64_decode($data); $length = strlen($data); $sstr = substr($data,0,-32); $bkey = str_replace($sstr,'',$data); if($key != $bkey) { return false; } $str = base64_decode($sstr); return $str; }