这里会显示出您选择的修订版和当前版本之间的差别。
— |
google:gae:get-query-parameters [2012/01/12 05:18] (当前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Google App Engine得到 GET/Post 参数 ====== | ||
+ | |||
+ | Google App Engine 使用了 Request 类来处理接收到的请求。 | ||
+ | |||
+ | 我们可以用 request的 get 函数来得到POST或GET的参数。 | ||
+ | |||
+ | ===== 使用案例 ===== | ||
+ | 下面的例子得到URL参数 number, 然后重定向到服务器的number.html 页面 | ||
+ | <code python> | ||
+ | class search_handler(webapp.RequestHandler): | ||
+ | def get(self): | ||
+ | n = self.request.get("number") | ||
+ | self.redirect("%s.html" % n) | ||
+ | #self.response.out.write(n) | ||
+ | </code> | ||
+ | |||
+ | ===== 参考: ===== | ||
+ | * http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html | ||