Flask返回json及设置session

@app.route('/api/v1/IndexSaveForm',methods=['POST'])
def IndexSaveForm():
    title = request.form.get('title')
    resData = {
        'title':title
    }
    return json.dumps(resData,ensure_ascii=False)



session['username']=username  #设置
print(session.get('username'))  #读取
session.clear  #清除
session.pop('username') #删除
session.permanent = True # 长期有效,一个月的时间有效

猜你喜欢

转载自blog.csdn.net/weixin_38639882/article/details/82145064