黑白人 2018-05-03 18:10:40 2189次浏览 0条回复 0 1 0

自己去添加相应的类库

$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' => [],
    ],
];
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS'){
    exit();
}
觉得很赞
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册