るりまサーチ

最速Rubyリファレンスマニュアル検索!
44件ヒット [1-44件を表示] (0.093秒)

別のキーワード

  1. cgi new
  2. cgi delete
  3. cgi update
  4. cgi close
  5. cgi accept_charset

ライブラリ

クラス

モジュール

キーワード

検索結果

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

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

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

ヘッダのキ...
...効期限を Time のインスタンスで指定します。
Expires ヘッダに対応します。
: cookie
クッキーとして文字列か CGI::Cookie のインスタンス、またはそれらの配列かハッシュを指定します。
一つ以上の Set-Cookie ヘッダに対応しま...
...字列で HTTP ヘッダを生成するための情報を指定します。

例:
header

# Content-Type: text/html

header
("text/plain")
# Content-Type: text/plain

header
({"nph" => true,
"status" => "OK", # == "200 OK"...

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

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

...P ヘッダを生成するための情報を指定します。

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

cgi
.out("text/plain"){ "string" }
# Content-Type: text/plain...
...tml; charset=iso-2022-jp
"language" => "ja",
"expires" => Time.now + (3600 * 24 * 30),
"cookie" => [cookie1, cookie2],
"my_header1" => "my_value",
"my_header2" => "my_value"}){ "string" }

@see CGI#header...

Net::HTTPHeader#content_type -> String|nil (3013.0)

"text/html" のような Content-Type を表す 文字列を返します。

...場合には nil を返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/comments.cgi?post=comment')
req = Net::HTTP::Post.new(uri.request_uri)
req.content_type # => nil
req.content_type = 'multipart/form-data'
req.content_type # => "multipart/form-data...

WEBrick::HTTPUtils::FormData#[](header) -> String | nil (142.0)

自身が multipart/form-data なデータの場合に、header で指定された ヘッダの値を文字列で返します。無ければ nil を返します。

...の場合に、header で指定された
ヘッダの値を文字列で返します。無ければ nil を返します。

@param header ヘッダ名を文字列で指定します。大文字と小文字を区別しません。

例:

require "webrick/cgi"
class MyCGI < WEBrick::CGI
def do_GET...
...(req, res)
p req.query['q']['content-type'] #=> "plain/text"
end
end
MyCGI.new.start()...