本文簡要介紹ruby語言中 CGI::Cookie類
的用法。
Class
代表一個 HTTP cookie。
除了其特定的字段和方法之外, Cookie
實例是其值數組的委托者。
請參閱 RFC 2965。
使用示例
cookie1 = CGI::Cookie.new("name", "value1", "value2", ...) cookie1 = CGI::Cookie.new("name" => "name", "value" => "value") cookie1 = CGI::Cookie.new('name' => 'name', 'value' => ['value1', 'value2', ...], 'path' => 'path', # optional 'domain' => 'domain', # optional 'expires' => Time.now, # optional 'secure' => true, # optional 'httponly' => true # optional ) cgi.out("cookie" => [cookie1, cookie2]) { "string" } name = cookie1.name values = cookie1.value path = cookie1.path domain = cookie1.domain expires = cookie1.expires secure = cookie1.secure httponly = cookie1.httponly cookie1.name = 'name' cookie1.value = ['value1', 'value2', ...] cookie1.path = 'path' cookie1.domain = 'domain' cookie1.expires = Time.now + 30 cookie1.secure = true cookie1.httponly = true
相關用法
- Ruby Cookie.new用法及代碼示例
- Ruby Cookie.parse用法及代碼示例
- Ruby Context.save_history=用法及代碼示例
- Ruby Constants模塊用法及代碼示例
- Ruby Comparable.between?用法及代碼示例
- Ruby Complex.arg用法及代碼示例
- Ruby ComposedSet類用法及代碼示例
- Ruby Continuation類用法及代碼示例
- Ruby Complex.abs2用法及代碼示例
- Ruby Context.echo_on_assignment?用法及代碼示例
- Ruby Complex.angle用法及代碼示例
- Ruby Complex.polar用法及代碼示例
- Ruby Comment.extract_call_seq用法及代碼示例
- Ruby Comparable.clamp用法及代碼示例
- Ruby Complex.to_f用法及代碼示例
- Ruby Complex.cmp / numeric用法及代碼示例
- Ruby Complex.conj用法及代碼示例
- Ruby Converter.primitive_errinfo用法及代碼示例
- Ruby Config.get_value用法及代碼示例
- Ruby Context.echo?用法及代碼示例
- Ruby Command.arguments用法及代碼示例
- Ruby Complex類用法及代碼示例
- Ruby Complex.infinite?用法及代碼示例
- Ruby Complex.abs用法及代碼示例
- Ruby Context.echo_on_assignment用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Cookie類。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。