获取登陆的cookie

@param bool $is_array 是否以数值方式返回，默认否，返回字符串
@return string|array
321148
public function get_login_cookie($is_array = false){
		if (!$is_array)	return $this->cookie;
		$c_arr = explode(';',$this->cookie);
		$cookie = array();
		foreach($c_arr as $item) {
			$kitem = explode('=',trim($item));
			if (count($kitem)>1) {
				$key = trim($kitem[0]);
				$val = trim($kitem[1]);
				if (!empty($val)) $cookie[$key] = $val;
			}
		}
		return $cookie;
	}
530354
public function checkCookies()
    {
        if (sizeof($this->cookies) == 0) {
            return true;
        }
        $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
        $curr_cookies = $this->cookies;
        $this->cookies = array();
        foreach ($curr_cookies as $cookie) {
            if (!is_array($cookie)) {
                $this->debug('Remove cookie that is not an array');
                continue;
            }
            if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) {
                if (strtotime($cookie['expires']) > time()) {
                    $this->cookies[] = $cookie;
                } else {
                    $this->debug('Remove expired cookie ' . $cookie['name']);
                }
            } else {
                $this->cookies[] = $cookie;
            }
        }
        $this->debug('checkCookie: ' . sizeof($this->cookies) . ' cookies left in array');
        return true;
    }
410517
public static function cookie($index = null, $default = null)
	{
		return (func_num_args() === 0) ? $_COOKIE : \Arr::get($_COOKIE, $index, $default);
	}
290949
public function id($as_array = false)
    {
        $keys = static::getMapper()->getPrimaryKey();
        $id = [];

        foreach ($keys as $key) {
            $id[$key] = $this->get($key);
        }

        if ($as_array || count($id) > 1) {
            return $id;
        }

        return current($id);
    }
586802
public function getCookies()
    {
        $cookieArrays = $this->executor->execute(DriverCommand::GET_ALL_COOKIES);
        $cookies = [];

        foreach ($cookieArrays as $cookieArray) {
            $cookies[] = Cookie::createFromArray($cookieArray);
        }

        return $cookies;
    }
165061
function set_cookies(url, cookies) {
	if(is.string(cookies)) {
		cookies = [cookies];
	}
	debug.assert(url).is('object');
	debug.assert(url.host).is('string');
	debug.assert(cookies).is('array');

	//debug.log('Saving cookies for host = ', url.host);

	if(!is.array(_cookies[url.host])) {
		_cookies[url.host] = cookies;
		//debug.log('Saved new cookies as: ', _cookies[url.host]);
		return;
	}

	var tmp = {};

	function save_cookie(cookie) {
		var i = cookie.indexOf('=');
		var name = cookie.substr(0, ((i >= 1) ? i : cookie.length));
		tmp[name] = cookie;
	}

	ARRAY(_cookies[url.host]).forEach(save_cookie);
	ARRAY(cookies).forEach(save_cookie);

	_cookies[url.host] = ARRAY(Object.keys(tmp)).map(function(key) { return tmp[key]; }).valueOf();

	//debug.log('Saved new cookies as: ', _cookies[url.host]);
}
1145041
protected function getCookie()
    {
        if (isset($_COOKIE[$this->options['name']])) {
            $value = $_COOKIE[$this->options['name']];

            if ($value) {
                return json_decode($value);
            }
        }
    }
1043055
public function getCookies()
    {
        $out = [];
        foreach ($this->_cookies as $cookie) {
            $out[$cookie->getName()] = $this->convertCookieToArray($cookie);
        }

        return $out;
    }
1095777
public function getCookieParams() : array
    {
        $r = [];
        foreach ($this->cookies->toArray(false) as $k => $v) {
            $r[$k] = $v->getValue();
        }
        return $r;
    }
1092020
function getCookiesForRequest($cookies, $secure=false) {
		$cookie_str = '';
		if ((! is_null($cookies)) && (is_array($cookies))) {
			foreach ($cookies as $cookie) {
				if (! is_array($cookie)) {
					continue;
				}
	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
					if (strtotime($cookie['expires']) <= time()) {
						$this->debug('cookie has expired');
						continue;
					}
				}
				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
					$domain = preg_quote($cookie['domain']);
					if (! preg_match("'.*$domain$'i", $this->host)) {
						$this->debug('cookie has different domain');
						continue;
					}
				}
				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
					$path = preg_quote($cookie['path']);
					if (! preg_match("'^$path.*'i", $this->path)) {
						$this->debug('cookie is for a different path');
						continue;
					}
				}
				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
					$this->debug('cookie is secure, transport is not');
					continue;
				}
				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
			}
		}
		return $cookie_str;
  }
124841
public static function getCookiesFromHeader($header, $source_url)
  {
    $cookies = array();
    
    $hits = preg_match_all("#[\r\n]set-cookie:(.*)[\r\n]# Ui", $header, $matches);
    
    if ($hits && $hits != 0)
    {
      for ($x=0; $x<count($matches[1]); $x++)
      {
        $cookies[] = PHPCrawlerCookieDescriptor::getFromHeaderLine($matches[1][$x], $source_url);
      }
    }
    
    return $cookies;
  }
300583
public function cookie(array $cookie) {

        $cookies = '';

        foreach($cookie as $k => $v)

            $cookies .= $k . '=' . $v . ';';

        curl_setopt(self::$handle, CURLOPT_COOKIE, $cookies);

        return $this;
    }
1036040
public function radio ($current_rule = [], $label_list = [], $is_array = false) {
		return array_merge([
			['require', 'raise_exception' => true],
			['not_string_empty', 'is_array'	=> $is_array, 'is_last' => true],
			['key', $label_list, 'is_array'	=> $is_array, 'is_last' => true],
		], $is_array ? $this->adjustOption($current_rule, 'is_array', $is_array) : $current_rule);
	}
1369099
public function weChatUserSetCookieAndSession()
    {     
        $arr = $this->oAuth2UserInfoArray;
        $userid = $arr['UserId'];
        $deviceid = $arr['DeviceId'];

        $rec = Member::where('work_id', $userid)->first();

        if(count($rec)){
            
            if($rec->state === 0){
                //账号状态正常
                if(!Session::has('id')) Session::put('id', $rec->id);
                if(!Session::has('name')) Session::put('name', $rec->name);
                if(!Session::has('deviceid')) Session::put('deviceid', $deviceid);

                Cookie::queue('id', $rec->id, 20160);
                Cookie::queue('deviceid', $deviceid, 20160);

            }else{
                return view('40x',['color'=>'warning', 'type'=>'2', 'code'=>'2.1']);
            }
                
        }else{
            return view('40x',['color'=>'danger', 'type'=>'1', 'code'=>'1.2']);
        }

    }
288478
public function wysiwyg ($current_rule = [], $is_array = false) {
		return array_merge([
			['require', 'raise_exception' => true],
			['not_string_empty', 'is_array'	=> $is_array, 'is_last' => true],
			['html', array_merge(['script'], SecurityUtility::GetDefaultWatchAttributes(['style'])), 'is_array'	=> $is_array, 'is_last' => true],
		], $is_array ? $this->adjustOption($current_rule, 'is_array', $is_array) : $current_rule);
	}
456418
public function getCookies()
    {
        $cookies = [];
        $pattern = '#Set-Cookie: (.*?)=(.*?);#im';
        if (preg_match_all($pattern, $this->header . $this->body, $match)) {
            foreach ($match[1] as $co => $vo) {
                if (strtoupper($match[2][$co]) != 'EXPIRED') {
                    $cookies[$vo] = $match[2][$co];
                }
            }
        }
        return $cookies;
    }
211509
protected function _getCookieUserId()
    {
        $sUserID = null;
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $sShopID = $oConfig->getShopId();
        if (($sSet = Registry::getUtilsServer()->getUserCookie($sShopID))) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $aData = explode('@@@', $sSet);
            $sUser = $aData[0];
            $sPWD = @$aData[1];

            $sSelect = $this->formUserCookieQuery($sUser, $sShopID);
            $rs = $oDb->select($sSelect);
            if ($rs != false && $rs->count() > 0) {
                while (!$rs->EOF) {
                    $sTest = crypt($rs->fields[1], static::USER_COOKIE_SALT);
                    if ($sTest == $sPWD) {
                        // found
                        $sUserID = $rs->fields[0];
                        break;
                    }
                    $rs->fetchRow();
                }
            }
            // if cookie info is not valid, remove it.
            if (!$sUserID) {
                Registry::getUtilsServer()->deleteUserCookie($sShopID);
            }
        }

        return $sUserID;
    }