0
내 모델의 beforeSave 메소드에서 일부 데이터를 암호화하려고합니다. 그러나 구원받지 못하고 있습니다.CakePHP 2.0 Security :: 암호 결과가 저장되지 않습니다.
$currentBalance = $this->find("all", array(
"fields" => array(
"SUM(base_amount) as 'CurrentBalance'"
),
"conditions" => array(
"Payment.user_id" => $this->data["Payment"]["user_id"]
)
));
$this->log($this->data["Payment"]);
$this->log(Configure::read("Security.salt"));
$this->log(Security::cipher(implode("|", $this->data["Payment"]), Configure::read("Security.cipherSeed")));
$this->set("balance", $currentBalance[0][0]["CurrentBalance"] + $this->data["Payment"]["base_amount"]);
$this->set("balance_checksum", Security::cipher(implode("|", $this->data["Payment"]), Configure::read("Security.salt")));
로그 파일을 보면 암호화 된 데이터를 얻을 수 있지만 모두 giberish입니다.
데이터베이스에있는 동안 나는 아무 것도 얻지 못합니다.
"123"이라고하는 간단한 문자열로 암호 기능을 바꾸면 올바르게 저장됩니다.
데이터베이스 연결이 utf8로 인코딩되었고 데이터베이스의 필드가 utf8 데이터 정렬을 사용하도록했습니다. 이에
모든 포인터는
감사