我使用str_replace()
后解码编码值有问题。它与编码完美配合,但是当我尝试解码它时,它什么也不返回。我也配置了$config['encryption_key']
,但我仍然在codeigniter 3.x中遇到这个问题。请帮助我解决这个问题。Codeigniter解码函数不返回值
/*encoding*/
$tmp = $this->encrypt->encode($val);
$encoded_val = str_replace(array('+','/','='),array('-','_',''),$tmp); //removal of specific characters to eliminate uri segment issue
return $encoded_val;
/*decoding*/
$decoded_val = str_replace(array('-','_',''),array('+','/','='),$val); //getting original encoded value
$tmp = $this->encrypt->decode($decoded_val);
return $tmp;
//encryption key
$config['encryption_key'] = "someencryptionkey";
它的工作完美与以前的版本,即codeigniter 2.x – Kathirmalan
停止使用'CI_Encrypt',它已被弃用的原因。 – Narf
https://www.codeigniter.com/user_guide/libraries/encrypt.html – qwertzman