简体   繁体   English

PHP:存储mcrypt的结果

[英]PHP: Storing the result of mcrypt

I've just setup Mcrypt properly in my framework and thought it would be sweet to be able to store Encrypted sessions, but I've just can't get it to work. 我刚刚在我的框架中正确设置了Mcrypt,并认为能够存储加密会话会很好,但我只是无法让它工作。 It

The output from Mcrypt is looking something like þøÆ{”ò(ü´îÚÜÇW¹ËŸK¯L'rø?ª¶!JF£º+Œ'Ú , so I thought that I would need to convert it to reduce the risk of charset-related issues. I've tried utf_8_encode and base_64_encode - nothing seems to work. Mcrypt的输出看起来像þøÆ{”ò(ü´îÚÜÇW¹ËŸK¯L'rø?ª¶!JF£º+Œ'Ú I I I I I I I问题。我尝试过utf_8_encodebase_64_encode - 似乎没什么用。

Just to ensure, I've changed modes of Mcrypt to cfb , cbc & ofb modes. 为了确保,我已经将Mcrypt的模式改为cfbcbcofb模式。 Again, no difference. 再一次,没有区别。

How should I encode the output of mcrypt to make it universally work for sessions, databases and so on? 我应该如何编码mcrypt的输出,使其普遍适用于会话,数据库等?

PHP's function is called base64_encode() not base_64_encode() as you have posted. PHP的函数被称为base64_encode()而不是你发布的base_64_encode() That method should work, and would be preferred. 该方法应该有效,并且是首选。 What about it is failing, if you are indeed using the correct function name? 如果您确实使用了正确的函数名称,它会失败吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM