zoukankan      html  css  js  c++  java
  • Request

    Request

    The Request class provides many methods for examining the HTTP request for your application and extends the SymfonyComponentHttpFoundationRequest class.

    Please note that both Input and Request do NOT sanitize your data, it is up to you to do that.

    Retrieving The Request URI

    $uri = Request::path();

    Retrieving The Request Method

    $method = Request::method();
    
    if (Request::isMethod('post'))
    {
        //
    }

    Determine If The Request Path Matches A Pattern

    if (Request::is('admin/*'))
    {
        //
    }

    Get The Request URL

    $url = Request::url();

    Retrieve A Request URI Segment

    $segment = Request::segment(1);

    Retrieving A Request Header

    $value = Request::header('Content-Type');

    Retrieving Values From $_SERVER

    $value = Request::server('PATH_INFO');

    Determine If The Request Is Over HTTPS

    if (Request::secure())
    {
        //
    }

    Determine If The Request Is Using AJAX

    if (Request::ajax())
    {
        //
    }

    Determine If The Request Has JSON Content Type

    if (Request::isJson())
    {
        //
    }

    Determine If The Request Is Asking For JSON

    if (Request::wantsJson())
    {
        //
    }

    Checking The Requested Response Format

    The Request::format method will return the requested response format based on the HTTP Accept header:

    if (Request::format() == 'json')
    {
        //
    }
  • 相关阅读:
    #2019120500018-LG 小雨的数字游戏
    假期Noip笔记
    #2019120500016 逆序对与归并排序
    #2019120500015-LG 全排列
    #2019120500014-LG 采药
    #2019120500013-LG 合并果子
    二分与三分
    #2019120500012-LG 小鱼比可爱
    #2019120500011-LG 约瑟夫问题&玩具谜题
    HDU 5738 共线点集
  • 原文地址:https://www.cnblogs.com/chunguang/p/5643008.html
Copyright © 2011-2022 走看看