Lndj\Lcrawl::getCookie PHP 메소드

getCookie() 공개 메소드

Get cookie from cache or login.
public getCookie ( boolean $forceRefresh = false ) : string
$forceRefresh boolean
리턴 string
    public function getCookie($forceRefresh = false)
    {
        $cacheKey = $this->cachePrefix . $this->stu_id;
        $cached = $this->getCache()->fetch($cacheKey);
        if ($forceRefresh || empty($cached)) {
            $jar = $this->login();
            //Cache the cookieJar 3000 s.
            $this->getCache()->save($cacheKey, serialize($jar), 3000);
            return $jar;
        }
        return unserialize($cached);
    }