src/Header.php
public function setCORS(
        $allowedOrigins = '*',
        $allowedMethods = '*',
        $allowedHeaders = '*',//'Authorization, Content-Type, X-Requested-With',
        $maxAge = 0,
        $supportsCredentials = false) {
        return $this->add([
            'Access-Control-Allow-Origin' => $allowedOrigins,
            'Access-Control-Allow-Credentials' => $supportsCredentials,
            'Access-Control-Allow-Methods' => $allowedMethods,
            'Access-Control-Max-Age' => $maxAge,
            'Access-Control-Allow-Headers' => $allowedHeaders
        ]);
    }
public function setCORS(
        $allowedOrigins = '*',
        $allowedMethods = '*',
        $allowedHeaders = '*',//'Authorization, Content-Type, X-Requested-With',
        $maxAge = 0,
        $supportsCredentials = false) {
        return $this->add([
            'Access-Control-Allow-Origin' => $allowedOrigins,
            'Access-Control-Allow-Credentials' => $supportsCredentials,
            'Access-Control-Allow-Methods' => $allowedMethods,
            'Access-Control-Max-Age' => $maxAge,
            'Access-Control-Allow-Headers' => $allowedHeaders
        ]);
    }
ajax 跨域响应，默认允许跨域
@param string $allowedOrigins
@param string $allowedMethods
@param string $allowedHeaders
@param int $maxAge
@param bool $supportsCredentials
@return Header