您的位置:首页 > 其它

Web2py也有意思的

2014-06-09 11:56 134 查看
多学学,以后可以方便的自己写代码了。

对于各种WEB框架,这也是打一个基础的时候。

相信学入门了,对PHP的,JAVA的WEB框架,都是能理解更深入的。



def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html

if you need a simple wiki simply replace the two lines below with:
return auth.wiki()
"""
if not session.counter:
session.counter = 1
else:
session.counter += 1
#response.flash = T("Welcome to web2py!")
return dict(message="Hello, Sky from MyApp!", counter=session.counter)

def first():
form = SQLFORM.factory(Field('visitor_name', requires=IS_NOT_EMPTY()))
if form.process().accepted:
session.visitor_name = form.vars.visitor_name
redirect(URL('second'))
return dict(form=form)

def second():
if not request.function=='first' and not session.visitor_name:
redirect(URL('first'))
return dict()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: