栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

Request.php-1

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Request.php-1

 

namespace IlluminateHttp;

 

use Closure;

use ArrayAccess;

use SplFileInfo;

use RuntimeException;

use IlluminateSupportArr;

use IlluminateSupportStr;

use IlluminateSupportTraitsMacroable;

use IlluminateContractsSupportArrayable;

use SymfonyComponentHttpFoundationParameterBag;

use SymfonyComponentHttpFoundationRequest as SymfonyRequest;

// long namespace

class Request extends SymfonyRequest implements Arrayable, ArrayAccess

{// Request

    use Macroable;// use trait

 

   

    protected $json;// The decoded JSON content for the request.

 

   

    protected $convertedFiles;//converted file

 

   

    protected $userResolver;//The user resolver callback.

 

   

    protected $routeResolver;// The route resolver callback.

 

   

    public static function capture()

    {

        static::enableHttpMethodParameterOverride();// static::

 

        return static::createFrombase(SymfonyRequest::createFromGlobals());

    }// Create a new Illuminate HTTP request from server variables.

 

   

    public function instance()

    {

        return $this;

    }//Return the Request instance

 

   

    public function method()

    {

        return $this->getMethod();

    }// get the request method.

 

   

    public function root()

    {

        return rtrim($this->getSchemeAndHttpHost().$this->getbaseUrl(), '/');

    }// Get the root URL for the application.

 

   

    public function url()

    {

        return rtrim(preg_replace('/?.*/', '', $this->getUri()), '/');

    }// Get the URL (no query string) for the request.

 

   

    public function fullUrl()

    {

        $query = $this->getQueryString();// query ,get Query String

 

        $question = $this->getbaseUrl().$this->getPathInfo() == '/' ? '/?' : '?';// question

 

        return $query ? $this->url().$question.$query : $this->url();// query

    }// Get the full URL for the request.

 

   

    public function path()

    {

        $pattern = trim($this->getPathInfo(), '/');

 

        return $pattern == '' ? '/' : $pattern;

    }//get Path

 

   

    public function decodedPath()

    {

        return rawurldecode($this->path());

    }//decode Path get the path

 

   

    public function segment($index, $default = null)

    {

        return Arr::get($this->segments(), $index - 1, $default);

    }//Get a segment from the URI (1 based index).

 

   

    public function segments()

    {

        $segments = explode('/', $this->path());

 

        return array_values(array_filter($segments, function ($v) {

            return $v != '';

        }));// array_values.

    }// Get all of the segments for the request path

 

   

    public function is()

    {

        foreach (func_get_args() as $pattern) {

            if (Str::is($pattern, urldecode($this->path()))) {

                return true;

            }

        }

 

        return false;

    }// check current request.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/229491.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号