php实现base64的编码和解码
时间:2021-07-01 10:21:17
帮助过:16人阅读
- class encryptCalss
- {
- var $key=12;
- function encode($txt){
- for($i=0;$i $txt[$i]=chr(ord($txt[$i])+$this->key);
- }
- return $txt=urlencode(base64_encode(urlencode($txt)));
- }
- function decode($txt){
- $txt=urldecode(base64_decode($txt));
- for($i=0;$i $txt[$i]=chr(ord($txt[$i])-$this->key);
- }
- return $txt;
- }
- }
- ?>
|
php