skip to main
|
skip to sidebar
memo temp
2009年1月10日 星期六
Some cgi memo
cgi api
CGI 這個 class 提供了一些好用的 method, 一些 url, html 的 encode ,decode
scape(string)
#URL-encode a string.
url_encoded_string = CGI::escape("'Stop!' said Fred")
# => "%27Stop%21%27+said+Fred"
escapeElement(string, *elements)
指定妳想encode 的tag, Escape only the tags of certain HTML elements in string
print CGI::escapeElement('
', "A", "IMG")
# "
<A HREF="url"></A>"
print CGI::escapeElement('
', ["A", "IMG"])
# "
<A HREF="url"></A>"
escapeHTML(string)
Escape special characters in HTML, namely &\"<>
CGI::escapeHTML('Usage: foo "bar"
')
# => "Usage: foo "bar" <baz>"
parse(query)
Parse an HTTP query string into a hash of key=>value pairs.
>> CGI::parse("a=b,5&c=d")
=> {"a"=>["b,5"], "c"=>["d"]}
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
state chart
eb
關於我自己
Lake
檢視我的完整簡介
pie chart
網誌存檔
►
2010
(1)
►
11月
(1)
▼
2009
(26)
▼
1月
(26)
Migrations in Rails 2.1
Non Active Record Model
Going Back
Helpers Outside Views
JSON
javascript tips
改變 iframe 的 source
javascript in browser tips
cookies 設定
javascript在網頁頁面加載時的執行順序
ruby gzip, stringio
iframe 之間的互動
textarea 點選自動複製, copy
parent document
get,submit
activerecord, query cache
CSRF (Cross-Site Request Forgery) & InvalidAuthen...
some tips, add_to_base, save_with_validation, verify
Some cgi memo
javascript escape html
ruby & javascript url encode
rails 辨識brower
Some good tips
字串 String 一些好用的 function, scan, split, match, gsu...
CSS Tools: Reset CSS
Top 10 Ruby on Rails performance tips
►
2008
(26)
►
12月
(26)
沒有留言:
張貼留言