开发者

What's the proper way of setting the salt for cookies in Kohana 3?

开发者 https://www.devze.com 2023-03-14 14:08 出处:网络
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

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...


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消