What's the proper way of setting the salt for cookies in Kohana 3?
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.
精彩评论