当前位置: 首页>>代码示例>>PHP>>正文


PHP Cors::className方法代码示例

本文整理汇总了PHP中yii\filters\Cors::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Cors::className方法的具体用法?PHP Cors::className怎么用?PHP Cors::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\filters\Cors的用法示例。


在下文中一共展示了Cors::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => HttpBearerAuth::className(), 'except' => ['options']];
     $behaviors['corsFilter'] = ['class' => Cors::className()];
     return $behaviors;
 }
开发者ID:kuznetsov0209,项目名称:mercdev-soccer-server,代码行数:7,代码来源:SecureActiveController.php

示例2: behaviors

 public function behaviors()
 {
     // Options Request Behavior must going at first because swagger makes OPTIONS requests before POST
     // and this behavior must run early than VerbsFilter
     $behaviors = ['optionsRequestFilter' => OptionsRequestFilter::className()];
     $behaviors = array_merge($behaviors, parent::behaviors(), ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]], 'corsFilter' => Cors::className(), 'authenticator' => QueryParamAuthSwagger::className()]);
     return $behaviors;
 }
开发者ID:VictorGub,项目名称:yii2-swagger,代码行数:8,代码来源:Controller.php

示例3: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     // SEE https://github.com/yiisoft/yii2/pull/8626
     //$behaviors['corsFilter'] = [
     $behaviors[0] = ['class' => \yii\filters\Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], 'Access-Control-Request-Headers' => ['*'], 'Access-Control-Allow-Credentials' => true, 'Access-Control-Expose-Headers' => ['Link', 'X-Pagination-Current-Page', 'X-Pagination-Page-Count', 'X-Pagination-Per-Page', 'X-Pagination-Total-Count']]];
     //$behaviors['authenticator'] = [
     $behaviors[1] = ['class' => \yii\filters\auth\HttpBearerAuth::className(), 'except' => ['options']];
     return $behaviors;
 }
开发者ID:shaan360,项目名称:Yii2_foundation-apps,代码行数:10,代码来源:NestedActiveController.php

示例4: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $self = $this;
     return ['access' => ['class' => AccessControl::className(), 'only' => ['logout', 'signup'], 'rules' => [['actions' => ['signup'], 'allow' => true, 'roles' => ['?']], ['actions' => ['logout'], 'allow' => true, 'roles' => ['@']]], 'denyCallback' => function ($rule, $action) use($self) {
         if ('signup' == $action->id) {
             return $self->afterLogin();
         } else {
             return $self->redirect(['site/index']);
         }
     }], 'verbs' => ['class' => VerbFilter::className(), 'actions' => []], 'corsFilter' => ['class' => \yii\filters\Cors::className()]];
 }
开发者ID:shinzero999,项目名称:Eveda-yii,代码行数:14,代码来源:SiteController.php

示例5: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     if ($this->jsonCallback) {
         $behaviors['contentNegotiator']['formats']['*/*'] = Response::FORMAT_JSONP;
         $behaviors['contentNegotiator']['formats']['application/xml'] = Response::FORMAT_JSONP;
         $behaviors['contentNegotiator']['formats']['application/json'] = Response::FORMAT_JSONP;
     } else {
         $behaviors['contentNegotiator']['formats']['*/*'] = Response::FORMAT_JSON;
         $behaviors['contentNegotiator']['formats']['application/xml'] = Response::FORMAT_JSON;
         $behaviors['contentNegotiator']['formats']['application/json'] = Response::FORMAT_JSON;
     }
     $behaviors['corsFilter'] = ['class' => yii\filters\Cors::className(), 'cors' => Yii::$app->params['cors']];
     return $behaviors;
 }
开发者ID:hustshenl,项目名称:yii2-ucenter,代码行数:15,代码来源:RestController.php

示例6: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     //        $behaviors['corsFilter'] =
     //            [
     //                    'class' => Cors::className(),
     //                    'cors' => [
     //                        'Origin' => ['http://erp.local'],
     //                        'Origin' => ['*'],
     //                        'Access-Control-Request-Method' => ['GET', 'HEAD', 'OPTIONS'],
     //                    ],
     //            ];
     $behaviors['cors'] = ['class' => Cors::className()];
     return $behaviors;
 }
开发者ID:ninetor,项目名称:newerp,代码行数:15,代码来源:UserController.php

示例7: behaviors

 /**
  * @internal
  * Only allows POST requests to the hook endpoints
  */
 public function behaviors()
 {
     return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'view' => ['get']]], 'corsFilter' => ['class' => Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['GET', 'HEAD']]]];
 }
开发者ID:charlesportwoodii,项目名称:galnet-api,代码行数:8,代码来源:CommoditiesController.php

示例8: behaviors

 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => 'jsonrpc']], 'authenticator' => ['class' => CompositeAuth::className(), 'optional' => ['index'], 'authMethods' => [UserAuth::className(), QueryParamAuth::className(), HttpBearerAuth::className()]], 'corsFilter' => ['class' => Cors::className()]]);
 }
开发者ID:voenniy,项目名称:yii2-jsonrpc,代码行数:4,代码来源:FrontendController.php

示例9: behaviors

 public function behaviors()
 {
     return ['corsFilter' => ['class' => \yii\filters\Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['POST'], 'Access-Control-Request-Headers' => ['*']]]];
 }
开发者ID:sergey-exu,项目名称:myhome,代码行数:4,代码来源:SiteController.php

示例10: behaviors

 /**
  * @var User User for check access.
  */
 public function behaviors()
 {
     return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'corsFilter' => ['class' => \yii\filters\Cors::className()]];
 }
开发者ID:nguyentuansieu,项目名称:yii2-mailbox,代码行数:7,代码来源:DefaultController.php

示例11: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON, 'application/xml' => Response::FORMAT_XML]], 'corsFilter' => ['class' => \yii\filters\Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], 'Access-Control-Request-Headers' => ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization'], 'Access-Control-Allow-Credentials' => true, 'Access-Control-Max-Age' => 86400, 'Access-Control-Expose-Headers' => []]], 'authenticator' => ['class' => HttpBearerAuth::className(), 'only' => ['dashboard']]];
 }
开发者ID:aheart,项目名称:angularjs-yii2-part-2-authentication,代码行数:7,代码来源:ApiController.php

示例12: behaviors

 public function behaviors()
 {
     return \yii\helpers\ArrayHelper::merge(parent::behaviors(), [['class' => 'yii\\filters\\ContentNegotiator', 'formats' => ['application/json' => Response::FORMAT_JSON]], 'corsFilter' => ['class' => \yii\filters\Cors::className()]]);
 }
开发者ID:gorvic,项目名称:part1.yii2,代码行数:4,代码来源:UserController.php

示例13: array_merge

<?php

$config = ['components' => ['assetManager' => ['class' => 'yii\\web\\AssetManager', 'linkAssets' => true, 'appendTimestamp' => YII_ENV_DEV]], 'as locale' => ['class' => 'common\\behaviors\\LocaleBehavior', 'enablePreferredLanguage' => true], 'as corsFilter' => ['class' => \yii\filters\Cors::className(), 'cors' => ['Origin' => array_merge(['https://fr.proxfree.com', 'http://fr.proxfree.com', 'http://proxfree.com', Yii::getAlias('@frontendUrl'), Yii::getAlias('@backendUrl')], explode(',', Yii::getAlias('@frontendUrls')))]]];
if (YII_DEBUG) {
    /* $config['bootstrap'][]      = 'debug';
       $config['modules']['debug'] = [
       'class'      => 'yii\debug\Module',
       'allowedIPs' => ['127.0.0.1', '::1', '192.168.33.1'],
       ]; */
}
if (YII_ENV_DEV) {
    $config['modules']['gii'] = ['allowedIPs' => ['127.0.0.1', '::1', '192.168.33.1']];
}
return $config;
开发者ID:allhaze,项目名称:renault,代码行数:14,代码来源:web.php

示例14: behaviors

 public function behaviors()
 {
     return ['corsFilter' => ['class' => \yii\filters\Cors::className()]];
 }
开发者ID:2012lucho,项目名称:TPB,代码行数:4,代码来源:BuscadorController.php

示例15: behaviors

 public function behaviors()
 {
     return ArrayHelper::merge([['class' => Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['GET'], 'Access-Control-Request-Headers' => ['*']]]], parent::behaviors());
 }
开发者ID:aekkapun,项目名称:Yii2_foundation-apps,代码行数:4,代码来源:TagController.php


注:本文中的yii\filters\Cors::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。