-
请求头获取
return web.ctx.env 获取请求中解析的信息 包括端口 域名
查看全部 -
pyweb响应处理
查看全部 -
import web urls = ( '/index','index', '/blog/\d+','blog', '/(.*)','hello', ) app = web.application(urls, globals()) class index: def GET(self): query = web.input() return query class blog: def POST(self): data = web.input() return data def GET(self): return web.ctx.env class hello: def GET(self, name): return open(r'login.html').read() if __name__ == "__main__": app.run() #http://localhost:8080/index?name=python&age=18&city=shenzhen #http://localhost:8080/ #http://localhost:8080/blog/123?name=python
查看全部 -
pyweb请求处理
查看全部 -
pyweb请求流程
查看全部 -
import web urls = ( '/index','index', '/blog/\d+','blog', '/.(.*)','hello', ) app = web.application(urls, globals()) class index: #def GET(self): # return 'index method' def GET(self): return open(r'html5.html','r').read() class blog: def GET(self): return 'blog method' def POST(self): return 'blog post method' class hello: def GET(self,name): return 'hello ' + name if __name__ == "__main__": app.run() #http://localhost:8080/blog/76675667 #http://localhost:8080/index #http://localhost:8080/hello
查看全部 -
URL映射
查看全部 -
Web.py安装
查看全部 -
Web.py简介
查看全部 -
模板文件中<!DOCTYPE html>必须删掉
查看全部 -
html中使用python语法前要加$
查看全部 -
render.hello2(name);
hello2是网页名,name是参数
在hello2中第一行要加 $def with(name)
name为传进的参数,使用时要加美元符 $name
查看全部 -
render对象后跟网页名()
查看全部 -
模板文件读取 render.index("参数") 结果数据获取 model.select("sql") URL跳转 web.seeother("/")
参数‘temmplats’是存放网页的目录
查看全部 -
请求处理
查看全部
举报
0/150
提交
取消