るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.016秒)
トップページ > クエリ:type[x] > クラス:CGI[x]

別のキーワード

  1. rexml/document node_type
  2. win32ole ole_type
  3. rss type
  4. rss type=
  5. net/imap media_type

ライブラリ

キーワード

検索結果

CGI#header(options = "text/html") -> String (43.0)

HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。 このメソッドは文字列エンコーディングを変換しません。

... CGI#out と違い、標準出力には出力しません。
CGI
#out を使わずに自力で HTML を出力したい場合などに使います。
このメソッドは文字列エンコーディングを変換しません。

ヘッダのキーとしては以下が利用可能です。

: type
C...
...ontent-Type ヘッダです。デフォルトは "text/html" です。
: charset
ボディのキャラクタセットを Content-Type ヘッダに追加します。
: nph
真偽値を指定します。真ならば、HTTP のバージョン、ステータスコード、
Date ヘッダをセッ...
...効期限を Time のインスタンスで指定します。
Expires ヘッダに対応します。
: cookie
クッキーとして文字列か CGI::Cookie のインスタンス、またはそれらの配列かハッシュを指定します。
一つ以上の Set-Cookie ヘッダに対応しま...

CGI#out(options = "text/html") { .... } (25.0)

HTTP ヘッダと、ブロックで与えられた文字列を標準出力に出力します。

...めの情報を指定します。

例:
cgi
= CGI.new
cgi
.out{ "string" }
# Content-Type: text/html
# Content-Length: 6
#
# string

cgi
.out("text/plain"){ "string" }
# Content-Type: text/plain
# Content-Length: 6...
...ver" => ENV['SERVER_SOFTWARE'],
"connection" => "close",
"type" => "text/html",
"charset" => "iso-2022-jp",
# Content-Type: text/html; charset=iso-2022-jp
"language" => "ja",
"expir...
...es" => Time.now + (3600 * 24 * 30),
"cookie" => [cookie1, cookie2],
"my_header1" => "my_value",
"my_header2" => "my_value"}){ "string" }

@see CGI#header...

CGI.escapeHTML(string) -> String (19.0)

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

...ます。

require "cgi"

p CGI.escapeHTML("3 > 1") #=> "3 &gt; 1"

print('<script type="text/javascript">alert("警告")</script>')

p CGI.escapeHTML('<script type="text/javascript">alert("警告")</script>')
#=> "&lt;script type=&quot;text/javascript&quot;...

CGI.escape_html(string) -> String (19.0)

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

...ます。

require "cgi"

p CGI.escapeHTML("3 > 1") #=> "3 &gt; 1"

print('<script type="text/javascript">alert("警告")</script>')

p CGI.escapeHTML('<script type="text/javascript">alert("警告")</script>')
#=> "&lt;script type=&quot;text/javascript&quot;...