获取Slim Framework设置的Cookie的加密哈希字符串

时间:2014-03-14 14:28:44

标签: php cookies encryption hash slim

如何在Slim Framework中获取加密的散列字符串。我用过:

$app = new \Slim\Slim(array(
    'cookies.encrypt' => true,
    'cookies.secret_key' => 'MY_SECRET_KEY',
    'cookies.cipher' => MCRYPT_RIJNDAEL_256,
    'cookies.cipher_mode' => MCRYPT_MODE_CBC
        ));

 $app->setCookie('_hsio', "My Data", '1 day');
 $app->getCookie('_hsio');

以上$app->getCookie('_hsio');将返回解密数据,但我想获取由setCookie设置的加密哈希字符串。知道怎么做吗?

1 个答案:

答案 0 :(得分:1)

你可以从Request对象中获取它:

$app->request->cookies->get('_hsio');