pear2007
- pear2007 2020-04-26 已签到连续签到1天,获得了5个金钱
- pear2007 2020-04-22 已签到连续签到1天,获得了5个金钱
- pear2007 2020-04-15 已签到连续签到1天,获得了5个金钱
- pear2007 2020-04-01 已签到连续签到2天,获得了10个金钱
- pear2007 2020-03-31 已签到连续签到1天,获得了5个金钱
- pear2007 2020-03-04 已签到连续签到1天,获得了5个金钱
- pear2007 回复了 xiachaoqing 的评论
按照上面做的,一直报401,Your request was made with invalid credentials
可以参考下
public function behaviors(){ $behaviors = parent::behaviors(); $auth = $behaviors['authenticator']; unset($behaviors['authenticator']); // add CORS filter $behaviors['corsFilter'] = [ 'class' => \yii\filters\Cors::class, 'cors' => [ // restrict access to 'Origin' => ['*'], 'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], 'Access-Control-Request-Headers' => ['*'], // 'Access-Control-Allow-Credentials' => true, // Allow OPTIONS caching 'Access-Control-Max-Age' => 3600, // Allow the X-Pagination-Current-Page header to be exposed to the browser. 'Access-Control-Expose-Headers' => ['x-pagination-current-page','x-pagination-page-count','x-pagination-per-page','x-pagination-total-count','link'], ], ]; // re-add authentication filter $behaviors['authenticator'] = $auth; // avoid authentication on CORS-pre-flight requests (HTTP OPTIONS method) $behaviors['authenticator']['except'] = ['options']; if (Yii::$app->getRequest()->getMethod() !== 'OPTIONS') { $behaviors['authenticator'] = [ 'class' => HttpBearerAuth::class, ]; } return $behaviors; }
- pear2007 2020-01-20 已签到连续签到1天,获得了5个金钱
- pear2007 2020-01-17 已签到连续签到2天,获得了10个金钱
- pear2007 2020-01-16 已签到连续签到1天,获得了5个金钱