在 Kohana 3 中为饼干设置盐的正确方法是什么?

发布于 2024-11-16 23:06:46 字数 153 浏览 4 评论 0原文

我可以深入研究 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

热鲨 2024-11-23 23:06:46

要么在 bootstrap: 中设置它

Cookie::$salt = 'foobar';

,要么像 @davgothic 所说的那样扩展 cookie 类。

不要修改系统文件夹中的代码。从来没有必要这样做。

Either set it in bootstrap:

Cookie::$salt = 'foobar';

Or extend the cookie class like @davgothic says.

Don't modify code in your system folder. There's never a need to do that.

不甘平庸 2024-11-23 23:06:46

这可以通过在 application/classes 中创建一个包含以下内容的 cookie.php 文件来完成:

class Cookie extends Kohana_Cookie
{
    public static $salt = 'foobar';
} // End Cookie

不过,我建议使用下面的 zombor 方法。

It can be done by creating a cookie.php file in application/classes with the following contents:

class Cookie extends Kohana_Cookie
{
    public static $salt = 'foobar';
} // End Cookie

I would advise going with zombor's approach below though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文