src/Auth/CookieAuth.php
function set($name, $params, $expire = 0)
    {
        if ($params === '' || $params === null) {
            $expire = time() - 3600;
            $value = null;
        } else {
            $encryptKey = $this->getEncryptKey($name);
            if (is_array($params)) {
                $params = json_encode($params);
            }
            $value = Helper::authCode($params, 'ENCODE', $encryptKey);
            if ($expire > 0) {
                $expire = time() + $expire;
            }
        }

        $cookie_domain = null;
        if (defined('COOKIE_DOMAIN')) {
            $cookie_domain = COOKIE_DOMAIN;
        }

        if (setcookie($name, $value, $expire, '/', $cookie_domain, null, true)) {
            return true;
        }

        return false;
    }
function set($name, $params, $expire = 0)
    {
        if ($params === '' || $params === null) {
            $expire = time() - 3600;
            $value = null;
        } else {
            $encryptKey = $this->getEncryptKey($name);
            if (is_array($params)) {
                $params = json_encode($params);
            }
            $value = Helper::authCode($params, 'ENCODE', $encryptKey);
            if ($expire > 0) {
                $expire = time() + $expire;
            }
        }

        $cookie_domain = null;
        if (defined('COOKIE_DOMAIN')) {
            $cookie_domain = COOKIE_DOMAIN;
        }

        if (setcookie($name, $value, $expire, '/', $cookie_domain, null, true)) {
            return true;
        }

        return false;
    }
生成加密cookie

@param string $name
@param string|array $params
@param int $expire
@return bool|mixed