English 中文(简体)
铁路中过期饼干的差别
原标题:Differences in expires_in cookies in Rails

区别在于:

cookies[:login] = { :value => "XJ-122", :expires => 1.hour.from_now }

cookies[:login] = { :value => "XJ-122", :expires => 1.hour }

Aren t both times calculated at the time the cookie is set, 和therefore from_now is irrelevant?

最佳回答

你可以用"铁路控制台" 来检查你的理解

$ rails c
Loading development environment (Rails 3.2.3)
1.9.2-p318 :001 > 1.hour
 => 3600 seconds 
1.9.2-p318 :002 > 1.hour.class
 => Fixnum 
1.9.2-p318 :003 > 1.hour.from_now
 => Fri, 25 May 2012 04:16:57 UTC +00:00 
1.9.2-p318 :004 > 1.hour.from_now.class
 => ActiveSupport::TimeWithZone 

活动支持: " 时间与区 " 是美化的时间类。

: 完成需要一个时间实例。 所以, 您应该使用 1 小时。 从_ 开始 。

问题回答

暂无回答




相关问题
How to suppress/remove PHP session cookie

I need to suppress an already set session cookie header, but I cannot find any way to do this. Why? I need to make an image, sent by a PHP script, cacheable by the end user; this image is used to ...

Remove Cookies from JS or CSS files

Bizarrely my javascript and css files have cookies (says Firebug). I use Zend Framework and I think it has to do with it. Could I change the .htaccess that CSS or JS files don t link to the ZF or is ...

httplib2, how to set more than one cookie?

As you are probably aware, more often than not, an HTTP server will send more than just a session_id cookie; however, httplib2 handles cookies with a dictionary, like this: response, content = http....

cookies control

what tool wold you recommend me to use in order to see what data are stored in my cookies while i m browsing the net. I m a beginner into webdev field(6 months php experience) and i m curious to see ...

热门标签