public function toRequestArray(string $uri = ''): array
    {
        $r = [];
        if (!empty($this->raw)) {
            $priorities = [];
            /** @var $cookie Cookie */
            foreach ($this->raw as $cookie) {
                if ($cookie->isValid($uri)) {
                    //Session cookie or unexpired && match domain path
                    $priority = strlen($cookie->domain); //Record priority, the higher the match, the higher the priority
                    if (!isset($r[$cookie->name]) || $priorities[$cookie->name] < $priority) {
                        //The cookie of the name is not set or the cookie set has a lower priority than the current cookie
                        $r[$cookie->name] = $cookie->value;
                        $priorities[$cookie->name] = $priority;
                    }
                }
            }
        }

        return $r;
    }
public function toRequestArray(string $uri = ''): array
    {
        $r = [];
        if (!empty($this->raw)) {
            $priorities = [];
            /** @var $cookie Cookie */
            foreach ($this->raw as $cookie) {
                if ($cookie->isValid($uri)) {
                    //Session cookie or unexpired && match domain path
                    $priority = strlen($cookie->domain); //Record priority, the higher the match, the higher the priority
                    if (!isset($r[$cookie->name]) || $priorities[$cookie->name] < $priority) {
                        //The cookie of the name is not set or the cookie set has a lower priority than the current cookie
                        $r[$cookie->name] = $cookie->value;
                        $priorities[$cookie->name] = $priority;
                    }
                }
            }
        }

        return $r;
    }
public function toRequestArray ( string $ uri = '' ) : array { $ r = [ ] ; if ( ! empty ( $ this -> raw ) ) { $ priorities = [ ] ; /** @var $cookie Cookie */ foreach ( $ this -> raw as $ cookie ) { if ( $ cookie -> isValid ( $ uri ) ) { //Session cookie or unexpired && match domain path $ priority = strlen ( $ cookie -> domain ) ; //Record priority, the higher the match, the higher the priority if ( ! isset ( $ r [ $ cookie -> name ] ) || $ priorities [ $ cookie -> name ] < $ priority ) { //The cookie of the name is not set or the cookie set has a lower priority than the current cookie $ r [ $ cookie -> name ] = $ cookie -> value ; $ priorities [ $ cookie -> name ] = $ priority ; } } } } return $ r ; }
Turn Cookies into k=>v key-value pairs for Request

@param string $uri 资源标记位置

@return array
Turn Cookies into k = > v key - value pairs for Request