【发布时间】:2013-08-15 09:17:02
【问题描述】:
我的模型中有一个 beforeSave 和 afterFind 函数。函数加解密字符串成功:
public function beforeSave($options = array()) {
foreach($this->encryptedFields as $fieldName){
if(!empty($this->data[$this->alias][$fieldName])){
$this->data[$this->alias][$fieldName] = Security::rijndael($this->data[$this->alias][$fieldName], Configure::read('Security.key'), 'encrypt');
}
}
return true;
}
但是。如果我这样做
$mobileno = 1234
$mobile = Security::rijndael($mobileNo, Configure::read('Security.key'), 'encrypt');
然后我运行查询,例如:
select * from table where mobileno = $mobileno;
我无法得到结果。因为现在我上面加密的mobileno与db中的加密手机号码不同。
【问题讨论】:
标签: cakephp encryption cakephp-2.0 cakephp-2.1 rijndael