我试过:
$data = array('ip'=>'120.0.3.4','user'=>'robert');
$this->load->library('encrypt');
$this->encrypt->set_cipher(MCRYPT_RIJNDAEL_256);
$this->encrypt->set_mode(MCRYPT_MODE_ECB);
$key = random_string();
$o=$this->encrypt->encode($data,$key);
var_dump($o);
$this->encrypt->set_cipher(MCRYPT_RIJNDAEL_256);
$this->encrypt->set_mode(MCRYPT_MODE_ECB);
$o = $this->encrypt->decode($o,$key);
var_dump($o);
它在解码中返回奇怪的字符:
string(44) "CVwMzZGkzagW4wHbUZfNpVWACQp2Fx4TeAO2KLqZs3I=" string(32) "��pz��xJx�jʊ8�Kw��mS�Y �1�_�"
有什么建议吗?
这是由数组加密引起的吗?我需要按值加密值而不是加密所有数组以使用加密数据数组?谢谢