26 lines
404 B
PHP
26 lines
404 B
PHP
<?php
|
|
|
|
namespace common\helpers;
|
|
use Yii;
|
|
|
|
use yii\filters\Cors;
|
|
|
|
|
|
class CorsCustom extends Cors
|
|
{
|
|
|
|
public function beforeAction($action){
|
|
|
|
parent::beforeAction($action);
|
|
|
|
if (Yii::$app->getRequest()->getMethod() === 'OPTIONS') {
|
|
Yii::$app->getResponse()->getHeaders()->set('Allow', 'POST GET PUT');
|
|
Yii::$app->end();
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|