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


PHP Slim::call方法代码示例

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


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

示例1: call

 /**
  * Call
  * @param   array $env
  * @return  array[status, header, body]
  */
 public function call(&$env)
 {
     $env['slim.flash'] = $this;
     list($status, $header, $body) = $this->app->call($env);
     $this->save();
     return array($status, $header, $body);
 }
开发者ID:normanyung,项目名称:poggin,代码行数:12,代码来源:Flash.php

示例2: call

 /**
  * Call
  * @param   array $env
  * @return  array[status, header, body]
  */
 public function call(&$env)
 {
     if (isset($env['CONTENT_TYPE'])) {
         $env['slim.input_original'] = $env['slim.input'];
         $env['slim.input'] = $this->parse($env['slim.input'], $env['CONTENT_TYPE']);
     }
     return $this->app->call($env);
 }
开发者ID:normanyung,项目名称:poggin,代码行数:13,代码来源:ContentTypes.php

示例3: call

 /**
  * Call
  * @param array $env
  * @return array[status, header, body]
  */
 public function call(&$env)
 {
     try {
         return $this->app->call($env);
     } catch (Exception $e) {
         $env['slim.log']->error($e);
         $response = new Slim_Http_Response($this->renderBody($env, $e), 500);
         return $response->finalize();
     }
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:15,代码来源:PrettyExceptions.php

示例4: call

 /**
  * Call
  *
  * Implements Slim middleware interface. This method is invoked and passed
  * an array of environemnt variables. This middleware inspects the environment
  * variables for the HTTP method override parameter; if found, this middleware
  * modifies the environment settings so downstream middleware and/or the Slim
  * application will treat the request with the desired HTTP method.
  *
  * @param   array $env
  * @return  array[status, header, body]
  */
 public function call(&$env)
 {
     if (isset($env['REQUEST_METHOD']) && $env['REQUEST_METHOD'] === 'POST') {
         $req = new Slim_Http_Request($env);
         $method = $req->post($this->settings['key']);
         if ($method) {
             $env['slim.method_override.original_method'] = $env['REQUEST_METHOD'];
             $env['REQUEST_METHOD'] = strtoupper($method);
         }
     }
     return $this->app->call($env);
 }
开发者ID:normanyung,项目名称:poggin,代码行数:24,代码来源:MethodOverride.php

示例5: testErrorHandlerUsesCurrentResponseObject

 /**
  * Test custom error handler uses existing Response object
  */
 public function testErrorHandlerUsesCurrentResponseObject()
 {
     $s = new Slim(array('debug' => false));
     $s->error(function (Exception $e) use($s) {
         $r = $s->response();
         $r->status(503);
         $r->write('Foo');
         $r['X-Powered-By'] = 'Slim';
         echo 'Bar';
     });
     $s->get('/bar', function () {
         throw new Exception('Foo');
     });
     $s->call();
     list($status, $header, $body) = $s->response()->finalize();
     $this->assertEquals(503, $status);
     $this->assertEquals('FooBar', $body);
     $this->assertEquals('Slim', $header['X-Powered-By']);
 }
开发者ID:rs3d,项目名称:Slimplr,代码行数:22,代码来源:SlimTest.php

示例6: testGetCurrentRoute

 /**
  * Test get current route
  */
 public function testGetCurrentRoute()
 {
     Slim_Environment::mock(array('REQUEST_METHOD' => 'GET', 'SCRIPT_NAME' => '', 'PATH_INFO' => '/foo'));
     $app = new Slim();
     $route1 = $app->get('/bar', function () {
         echo "Bar";
     });
     $route2 = $app->get('/foo', function () {
         echo "Foo";
     });
     $app->call();
     $this->assertSame($route2, $app->router()->getCurrentRoute());
 }
开发者ID:sjakk,项目名称:betatext,代码行数:16,代码来源:RouterTest.php

示例7: call

 /**
  * Call
  * @param   array $env
  * @return  array[status, header, body]
  */
 public function call(&$env)
 {
     $this->loadSession($env);
     list($status, $header, $body) = $this->app->call($env);
     return $this->saveSession($env, $status, $header, $body);
 }
开发者ID:normanyung,项目名称:poggin,代码行数:11,代码来源:SessionCookie.php


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