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 17th, 2019 at 10:19 am
如果觉得我的文章对你有用,请随意赞赏