`
skyfen
  • 浏览: 176981 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

mod_python中使用表单post用法

阅读更多


getmonth.psp模板文件

<title>输入一个日期</title>
   <body>
   <form method="POST"  name="form" action="http://192.168.1.91/py/getmonth.py">
   <p>
   <hr>
   <br />
   输入一个日期 2011年: <br />
   <INPUT type="text" name="month" value="2011-4-20">
   <br />
   <input type="submit" value="提交">
   </form>
   </body>


getmonth.py文件:接收POST过来的字段


from mod_python import apache,util

def index(req):
    #第一种getfirst获取值方法   
    #form = req.form.getfirst('month')
    #return  "日期: %s "%form
    #第二种form获取值方法
    return  "日期: %s "%req.form['month']

 

这都是在Apache配置纯python环境下的应用

 

参考:http://ghantoos.org/howto-apache2-mod_python/

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics