public function behaviors()
    {
        $behaviors = [
            'corsFilter' => [
                'class' => Cors::className(),
                'cors' => [
                    'Origin' => [],//跨域的域名数组
                    'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
                    'Access-Control-Request-Headers' => ['*'],
                    'Access-Control-Allow-Origin' => ['*'],
                    'Access-Control-Allow-Credentials' => true,
                    'Access-Control-Max-Age' => 86400,
                    'Access-Control-Expose-Headers' => [],
                ],
            ],
        ];
        return $behaviors;
    }                        
$.ajax({
    type: "POST",
    data: {},
    url: wxCheckUrl,
    async: false,
        crossDomain:true,
    success: function(msg) {}
    });
Last modification:December 17, 2019
如果觉得我的文章对你有用,请随意赞赏