本文介紹了CakePHP Security::cipher() 不適用于服務器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在讀取加密的 cookie 時遇到問題.調試顯示服務器上的 Security::cipher() 以某種方式損壞.反正我能解決嗎?
I'm having a problem with reading the encrpyted cookie. Debugging revealed that Security::cipher() on server is somehow broken. Is there anyway I could solve it?
下面是細分.
代碼
$value = "Hello World";
$key = Configure::read('Security.salt');
$val = Security::cipher($value, $key);
debug($val);
$ret = Security::cipher($val, $key);
debug($ret);
本地
appviewspageshome.ctp (line 17)
?J??WtJ0?
appviewspageshome.ctp (line 19)
Hello World
服務器
app/views/pages/home.ctp (line 17)
x?.??9v??
app/views/pages/home.ctp (line 19)
?{?U??g??O
推薦答案
Security::cipher() 正在使用 srand() 函數,該函數被 suhosin 模塊禁用,該模塊默認用于許多 Apache、PHP 服務器.
Security::cipher() is using srand() function which is disabled by suhosin module which comes as default for many Apache, PHP servers.
禁用 suhosin 和 Security::cipher() 將正常工作.
Disable suhosin and Security::cipher() will work fine.
這篇關于CakePHP Security::cipher() 不適用于服務器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!