天天看點

Django學習記錄之——request對象方法

request對象方法
    request.method
        擷取請求方式
    request.GET
        擷取get方法送出的參數
    request.POST
        擷取post方法送出的參數 不能擷取檔案
    request.FILES
        擷取檔案


    request.path
        擷取使用者輸入路由
    request.path_info
        擷取使用者輸入路由
    request.get_full_path()
        擷取使用者輸入路由和攜帶的參數

    print(request.path)     # / app02 / file /
    print(request.path_info)    # / app02 / file /
    print(request.get_full_path())  # / app02 / file /?user = 123

    request.body
        浏覽器發送過來的原生的二進制資料
        如果有get和post擷取不到的資訊,那麼就可以使用該屬性擷取