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


PHP App::options方法代码示例

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


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

示例1: register

 public function register(App &$app)
 {
     $self = $this;
     $app->post('/raids', function (Request $request, Response $response) use(&$self) {
         return $self->responseRaids($request, $response)->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Content-type', 'application/json');
     });
     $app->options('/raids', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type, X-AUTH-USER, X-AUTH-TOKEN');
     });
     $app->post('/raids/add', function (Request $request, Response $response) use(&$self) {
         return $self->responseRaidsAdd($request, $response)->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Content-type', 'application/json');
     });
     $app->options('/raids/add', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type, X-AUTH-USER, X-AUTH-TOKEN');
     });
 }
开发者ID:mroswald,项目名称:invme,代码行数:16,代码来源:Raids.php

示例2: register

 public function register(App &$app)
 {
     $self = $this;
     $app->post('/login', function (Request $request, Response $response) use(&$self) {
         return $self->responseLogin($request, $response)->withHeader('Content-type', 'application/json')->withHeader('Access-Control-Allow-Origin', '*');
     });
     $app->options('/login', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type');
     });
     $app->post('/login/check', function (Request $request, Response $response) use(&$self) {
         return $self->responseLoginCheck($request, $response)->withHeader('Content-type', 'application/json')->withHeader('Access-Control-Allow-Origin', '*');
     });
     $app->options('/login/check', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type');
     });
 }
开发者ID:mroswald,项目名称:invme,代码行数:16,代码来源:Login.php

示例3: register

 public function register(App &$app)
 {
     $app->get('/version', function (Request $request, Response $response) {
         $response->getBody()->write(json_encode("v1.0.0"));
         return $response->withHeader('Access-Control-Allow-Origin', '*');
     });
     $app->options('/version', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type');
     });
 }
开发者ID:mroswald,项目名称:invme,代码行数:10,代码来源:Version.php

示例4: testOptionsRoute

 public function testOptionsRoute()
 {
     $path = '/foo';
     $callable = function ($req, $res) {
         // Do something
     };
     $app = new App();
     $route = $app->options($path, $callable);
     $this->assertInstanceOf('\\Slim\\Route', $route);
     $this->assertAttributeContains('OPTIONS', 'methods', $route);
 }
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:11,代码来源:AppTest.php


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