在 Kohana 3 中为饼干设置盐的正确方法是什么?
我可以深入研究 Kohana_Cookie 类并设置
public static $salt = 'blah';
但这似乎不是一个非常优雅的解决方案...是否有正确的方法在配置等中设置它?尝试谷歌搜索,但没有运气......
I could just dive into the Kohana_Cookie class and set
public static $salt = 'blah';
But this doesn't seem like a very elegant solution... is there a propper way to set it in a config or such? Tried Googling around, but no luck...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要么在 bootstrap: 中设置它
,要么像 @davgothic 所说的那样扩展 cookie 类。
不要修改系统文件夹中的代码。从来没有必要这样做。
Either set it in bootstrap:
Or extend the cookie class like @davgothic says.
Don't modify code in your system folder. There's never a need to do that.
这可以通过在
application/classes
中创建一个包含以下内容的cookie.php
文件来完成:不过,我建议使用下面的 zombor 方法。
It can be done by creating a
cookie.php
file inapplication/classes
with the following contents:I would advise going with zombor's approach below though.