當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::run方法代碼示例

本文整理匯總了PHP中Silex\Application::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::run方法的具體用法?PHP Application::run怎麽用?PHP Application::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Silex\Application的用法示例。


在下文中一共展示了Application::run方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Handles the request and delivers the response.
  *
  * @param Request|null $request Request to process
  */
 public function run(BaseRequest $request = null)
 {
     if (null === $request) {
         $request = Request::createFromGlobals();
     }
     parent::run($request);
 }
開發者ID:ChigusaYasoda,項目名稱:ec-cube,代碼行數:12,代碼來源:Application.php

示例2: run

 /**
  * {@inheritdoc}
  */
 public function run(Request $request = null)
 {
     if ($this['config']->get('general/caching/request')) {
         $this['http_cache']->run($request);
     } else {
         parent::run($request);
     }
 }
開發者ID:bolt,項目名稱:bolt,代碼行數:11,代碼來源:Application.php

示例3: run

 /**
  * Overrides Silex's Application::run to handle console requests instead
  * of HTTP requests if the PHP SAPI name is cli
  *
  * {@inheritDoc}
  */
 public function run(Request $request = null)
 {
     if (php_sapi_name() !== 'cli') {
         return parent::run($request);
     }
     if (!$this->booted) {
         $this->boot();
     }
     $this['console']->run();
 }
開發者ID:bodetree,項目名稱:synapse-base,代碼行數:16,代碼來源:Application.php

示例4: testFinishFilter

 public function testFinishFilter()
 {
     $containerTarget = array();
     $app = new Application();
     $app->finish(function () use(&$containerTarget) {
         $containerTarget[] = '4_filterFinish';
     });
     $app->get('/foo', function () use(&$containerTarget) {
         $containerTarget[] = '1_routeTriggered';
         return new StreamedResponse(function () use(&$containerTarget) {
             $containerTarget[] = '3_responseSent';
         });
     });
     $app->after(function () use(&$containerTarget) {
         $containerTarget[] = '2_filterAfter';
     });
     $app->run(Request::create('/foo'));
     $this->assertSame(array('1_routeTriggered', '2_filterAfter', '3_responseSent', '4_filterFinish'), $containerTarget);
 }
開發者ID:jeanpimentel,項目名稱:slack-invitation,代碼行數:19,代碼來源:ApplicationTest.php

示例5: run

 public function run(Request $request = null)
 {
     $this->initialize();
     parent::run($request);
 }
開發者ID:garyr,項目名稱:phpbin,代碼行數:5,代碼來源:Application.php

示例6: run

 /**
  * @param Request|null $request
  */
 public function run(Request $request = null)
 {
     $this['request'] = $this->factory(function () {
         return $this['request_stack']->getCurrentRequest();
     });
     $this->before(function (Request $request) {
         $this["route"] = ['name' => $request->attributes->get("_route"), 'params' => $request->attributes->get("_route_params")];
         if (strpos($request->headers->get("Content-Type"), "application/json") === 0) {
             $data = json_decode($request->getContent(), true);
             $request->request->replace(is_array($data) ? $data : []);
         }
     });
     parent::run($request);
 }
開發者ID:kirinami,項目名稱:silex,代碼行數:17,代碼來源:App.php

示例7: run

 /**
  * Executes the Silex\Application->run() method
  *
  * @return void
  */
 public function run()
 {
     self::$application->run();
 }
開發者ID:ryanzec,項目名稱:salvomvc-component,代碼行數:9,代碼來源:Salvo.php

示例8: function

<?php

require_once 'vendor/autoload.php';
require_once 'FileHelper.php';
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
$app->post('/upload', function (Request $request) use($app) {
    // get file from requests
    $file = $request->files->get('image');
    // if null return error
    if ($file == null) {
        $obj = new stdClass();
        $obj->success = false;
        $obj->error = "No image provided";
        return json_encode($obj);
    }
    // upload the file and return the json with the data
    return json_encode(FileHelper::writeFile($file));
});
$app->run();
開發者ID:BoldijarPaul,項目名稱:upload-image-backend,代碼行數:22,代碼來源:api.php

示例9: run

 public function run()
 {
     $this->application->run();
 }
開發者ID:bflechel,項目名稱:OpenAddressBook,代碼行數:4,代碼來源:OpenAddressBook.php

示例10: run

 /**
  * @param Request $request
  * @return mixed
  */
 public function run(Request $request = null)
 {
     if (php_sapi_name() === 'cli') {
         return $this->getConsole()->run();
     }
     return parent::run($request);
 }
開發者ID:lukezbihlyj,項目名稱:silex-plus,代碼行數:11,代碼來源:Application.php

示例11: run

 /**
  * Execute application
  */
 public function run()
 {
     $this->app->run();
 }
開發者ID:skymeyer,項目名稱:csp-report-collector,代碼行數:7,代碼來源:Application.php

示例12: run

 public function run(Request $request = null)
 {
     parent::run($request);
 }
開發者ID:nhagemann,項目名稱:anycontent-repository-mysql-php,代碼行數:4,代碼來源:Application.php

示例13: run

 public function run(\Symfony\Component\HttpFoundation\Request $request = NULL)
 {
     // Initialisation of Flint
     $this->setupServicesAndConfig();
     // Initialisation of Silex
     $serviceOverride = null;
     if (method_exists($this, 'init')) {
         $serviceOverride = $this->init();
     }
     /**
      * Allows you to override the parent::run() method with a service inside the locator,
      * usually used for http_cache and other plugins
      */
     if ($serviceOverride !== null) {
         return $serviceOverride->run($request);
     }
     return parent::run($request);
 }
開發者ID:studionone,項目名稱:Flint,代碼行數:18,代碼來源:App.php

示例14: function

});
$application->get('/unique-number-repository/{name}', function (Application $application, $name) use($locator) {
    //begin of runtime parameters
    $name = urldecode($name);
    //end of runtime parameters
    //begin of dependencies
    $numberStorage = $locator->getUniqueNumberStorage();
    $repositoryStorage = $locator->getRepositoryStorage();
    //end of dependencies
    //begin of validation
    $repositoryStorage->filterByName($name);
    $repositoryDoesNotExist = !$repositoryStorage->has();
    if ($repositoryDoesNotExist) {
        $application->abort(404, 'repository does not exist');
    }
    $repositoryStorage->resetRuntimeProperties();
    //end of validation
    //begin of process
    $numberStorage->resetRuntimeProperties();
    $numberStorage->filterBy('repository_name', $name);
    $collection = $numberStorage->readMany();
    $content = array();
    foreach ($collection as $uniqueNumberRequest) {
        $content[] = array('number' => $uniqueNumberRequest->number());
    }
    return $application->json($content);
    //end of process
});
//end of routing
$application->run();
開發者ID:bazzline,項目名稱:unique_number_repository,代碼行數:30,代碼來源:server.php

示例15: run

 public function run()
 {
     $this->silex->run();
 }
開發者ID:ayurved,項目名稱:ayurveda-1,代碼行數:4,代碼來源:ayurveda.php


注:本文中的Silex\Application::run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。