当前位置: 首页>>代码示例>>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;未经允许,请勿转载。