2012-07-31 67 views
-1

我正在使用Cakephp 2.1。Cakephp 2.1加密和解密一个字符串

如何加密和解密字符串。

+0

你真的应该提供什么你更多的细节秘密口令想要做什么:你想要什么样的字符串加密和WH Ÿ什么样的加密?有不止一种... http://en.wikipedia.org/wiki/Encryption – bfncs 2012-08-23 10:15:52

回答

1

按照CakePHP的documentation

加密您与my_key

$secret = Security::cipher('my secret password', 'my_key');

后来解密的秘密口令

$nosecret = Security::cipher($secret, 'my_key');