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


PHP Dispatcher::getReturnedValue方法代码示例

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


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

示例1: createMvcFrom

 /**
  * @param array $config
  * @return MvcDispatcher
  */
 public static function createMvcFrom(array $config) : MvcDispatcher
 {
     $dispatcher = new MvcDispatcher();
     $dispatcher->setEventsManager(new EventManager());
     $dispatcher->setControllerSuffix(null);
     $dispatcher->setDefaultNamespace($config['controllerDefaultNamespace']);
     $dispatcher->getEventsManager()->attach('dispatch:afterDispatchLoop', function (Event $event, MvcDispatcher $dispatcher) {
         if ($dispatcher->getReturnedValue() instanceof \Phalcon\Http\Response) {
             $dispatcher->getDI()->setShared('response', $dispatcher->getReturnedValue());
         }
     });
     return $dispatcher;
 }
开发者ID:mamuz,项目名称:phalcon-application,代码行数:17,代码来源:Dispatcher.php

示例2: afterExecuteRoute

 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     if ($this->_isJsonResponse) {
         $data = $dispatcher->getReturnedValue();
         $this->response->setJsonContent($data);
         $this->response->send();
     }
 }
开发者ID:robinxiong,项目名称:cmsdb,代码行数:8,代码来源:ControllerBase.php

示例3: afterExecuteRoute

 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     sleep(2);
     $data = $dispatcher->getReturnedValue();
     $responseData = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
     $this->response->setContent($responseData);
     return $this->response->send();
 }
开发者ID:Wapweb,项目名称:qa-app,代码行数:8,代码来源:ControllerBase.php

示例4: afterExecuteRoute

 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     $this->view->disable();
     $data = $dispatcher->getReturnedValue();
     if (is_array($data)) {
         $data = json_encode($data);
     }
     $this->response->setContentType('application/json', 'UTF-8');
     $this->response->setContent($data);
     $this->response->send();
 }
开发者ID:sergeytkachenko,项目名称:angular-gulp-phalcon,代码行数:11,代码来源:ControllerBase.php

示例5: afterExecuteRoute

 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     if ($this->_isJsonResponse) {
         $data = $dispatcher->getReturnedValue();
         if (is_array($data)) {
             $data = json_encode($data);
         }
         $this->response->setContent($data);
         $this->response->send();
     }
 }
开发者ID:sergeytkachenko,项目名称:angular-gulp-phalcon,代码行数:11,代码来源:JsonController.php

示例6: afterExecuteRoute

 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     $data = $dispatcher->getReturnedValue();
     if ($this->restful) {
         if (is_array($data)) {
             $data = json_encode($data, JSON_UNESCAPED_UNICODE);
         }
     }
     $this->response->setContent($data);
     $this->response->send();
 }
开发者ID:jobhub,项目名称:phalcon-console,代码行数:11,代码来源:ControllerBase.php

示例7: afterExecuteRoute

 /**
  * After route executed event
  *
  * @param Dispatcher $dispatcher
  */
 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     $data = $dispatcher->getReturnedValue();
     if (is_array($data)) {
         $this->response->setJsonContent($data, JSON_UNESCAPED_UNICODE);
     } elseif (is_scalar($data)) {
         $this->response->setContent($data);
     }
     $this->response->send();
     exit;
 }
开发者ID:TheCodemasterZz,项目名称:phalcon-console,代码行数:16,代码来源:ControllerBase.php

示例8: afterExecuteRoute

 public function afterExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher)
 {
     /** @var \Model\ModelsRepository $modelsRepository */
     $modelsRepository = $dispatcher->getDI()->getService('modelsRepository')->resolve();
     if (!$modelsRepository) {
         return;
     }
     $returnedValue = $dispatcher->getReturnedValue();
     if (is_null($returnedValue)) {
         $returnedValue = [];
     }
     $modelsRepository->getPageContent()->processContent($dispatcher->getParams(), $returnedValue);
 }
开发者ID:sb15,项目名称:phalcon-ext,代码行数:13,代码来源:PageContentPlugin.php

示例9: afterExecuteRoute

 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     $this->view->disable();
     $data = $dispatcher->getReturnedValue();
     if (is_array($data) and array_key_exists('success', $data) and $data['success'] === false) {
         $this->setBadRequestStatus();
     }
     if (is_array($data)) {
         $data = json_encode($data);
     }
     $this->response->setContentType('application/json', 'UTF-8');
     $this->response->setContent($data);
     $this->response->send();
     // TODO bug fix
     exit;
 }
开发者ID:sergeytkachenko,项目名称:phalcon-rest-jpa,代码行数:16,代码来源:JsonController.php

示例10: afterExecuteRoute

 public function afterExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher)
 {
     /** @var \Phalcon\Mvc\View $view */
     $view = $dispatcher->getDI()->getService('view')->resolve();
     $returnedValue = $dispatcher->getReturnedValue();
     if ($returnedValue instanceof \Phalcon\Http\Response) {
         return false;
     }
     if (is_array($view->getParamsToView()) && array_key_exists(self::SET_JSON_RESPONSE, $view->getParamsToView())) {
         $view->disable();
         header('Content-type: application/json');
         echo json_encode($returnedValue);
         return false;
     }
     if (is_array($returnedValue)) {
         $view->setVars($returnedValue);
     }
 }
开发者ID:sb15,项目名称:phalcon-ext,代码行数:18,代码来源:ViewReturnPlugin.php

示例11: afterExecuteRoute

 /**
  * After execute route event
  *
  * @param Dispatcher $dispatcher
  */
 public function afterExecuteRoute(Dispatcher $dispatcher)
 {
     if ($this->request->isAjax() && $this->isJsonResponse()) {
         $this->view->disable();
         $this->response->setContentType('application/json', 'UTF-8');
         $data = $dispatcher->getReturnedValue();
         if (is_array($data)) {
             $this->response->setJsonContent($data);
         }
         echo $this->response->getContent();
     }
     $this->view->setViewsDir($this->view->getViewsDir() . 'admin/');
 }
开发者ID:gitter-badger,项目名称:phanbook,代码行数:18,代码来源:ControllerBase.php

示例12: afterExecuteRoute

 public function afterExecuteRoute(\Phalcon\Mvc\Dispatcher $dispatcher)
 {
     $this->setJsonContent($dispatcher->getReturnedValue());
 }
开发者ID:ynijar,项目名称:products,代码行数:4,代码来源:RestController.php

示例13: afterDispatchLoop

 public function afterDispatchLoop(Event $event, Dispatcher $dispatcher)
 {
     $di = $this->getDI();
     $response = $di->get('response');
     $content = $response->getContent();
     if ($content === '' && $dispatcher->getActiveController() instanceof RestControllerInterface) {
         $returnedResponse = $dispatcher->getReturnedValue() instanceof ResponseInterface;
         if ($returnedResponse === false) {
             /** @var \PhalconRest\Mvc\RestView $rest */
             $rest = $di->get('rest');
             /** @var Manager $eventsManager */
             $eventsManager = $this->_eventsManager;
             //$eventsManager = $dispatcher->getDI()->get('eventsManager');
             $renderStatus = true;
             if ($eventsManager instanceof ManagerInterface) {
                 $renderStatus = $eventsManager->fire('application:viewRender', $this, $rest);
             }
             if ($renderStatus) {
                 $rest->render($dispatcher->getControllerName(), $dispatcher->getActionName());
                 $content = $rest->getContent();
             }
             /** @var \Phalcon\Http\Response $response */
             $response = $di->get('response');
             $response->setContent($content)->send();
         }
     }
 }
开发者ID:serebro,项目名称:phalcon-rest,代码行数:27,代码来源:DispatcherEventsHandler.php

示例14: afterDispatch

 /**
  *
  * @param Event $event
  * @param Dispatcher $dispatcher
  */
 public function afterDispatch(Event $event, Dispatcher $dispatcher)
 {
     $result = $dispatcher->getReturnedValue();
     ResponseApi::sendOk($result);
 }
开发者ID:huxiaohe,项目名称:api-framework,代码行数:10,代码来源:DispatchIntercept.php


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