我使用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