當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。