本文簡要介紹ruby語言中 CGI::Cookie.new
的用法。
用法
new(name_string,*value)
new(options_hash)
創建一個新的 CGI::Cookie
對象。
name_string
-
cookie 的名稱;在這種形式中,沒有
domain
或到期。path
是從SCRIPT_NAME
環境變量中收集的,而secure
是假的。 *value
-
cookie 的值或值列表
options_hash
-
用於初始化此
Cookie
的選項的Hash
。可能的選項是:- 名字
-
cookie 的名稱。必需的。
- 值
-
cookie 的值或值列表。
- 小路
-
此 cookie 適用的路徑。默認為
SCRIPT_NAME
環境變量的值。 - 領域
-
此 cookie 適用的域。
- 過期
-
此 cookie 過期的時間,作為
Time
對象。 - 安全的
-
此 cookie 是否是安全 cookie(默認為 false)。安全 cookie 僅傳輸到 HTTPS 服務器。
- httponly
-
此 cookie 是否為 HttpOnly cookie(默認為
false). HttpOnly cookies are not available to javascript.
這些關鍵字對應於 cookie 對象的屬性。
調用超類方法
Array::new
相關用法
- Ruby Cookie.parse用法及代碼示例
- Ruby Cookie類用法及代碼示例
- 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.new。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。