我在一个页面的一个方向上有两个函数。
如何单独访问他们两个人? 现在发生的是,只有第一个函数被调用。
下面的程序是一个虚构的原型,我的需求建立在这个逻辑之上。
from bottle import get,post,run,route,request
content1 = '''
<html>
<h1>Page 1 function </h1>
<form action='details' method='post'>
<input type = "text" name="uname">
<input type = "submit" >
</form>
</html>'''
content11 = '''
<html>
<h1>Page 2 function </h1>
<form action='details' method='post'>
<input type = "text" name="uname">
<input type = "submit" >
</form>
</html>'''
content2 = '''<html><h1>Hello %s </h1></html>'''
@get('/home')
def page1():
return content1
def page2():
return content11
@post('/details')
def page3():
u_name = str(request.forms.get('uname'))
return content2 %u_name
run(host='localhost', port=8080, debug=True)发布于 2017-03-18 00:53:32
你问这个问题的方式意味着你想从同一个地址提供两个独立的网页。休息不是这样的。
您需要提供第二条路径来访问page2()中的代码
https://stackoverflow.com/questions/42484322
复制相似问题