本文整理匯總了PHP中Phalcon\Mvc\Application::useImplicitView方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::useImplicitView方法的具體用法?PHP Application::useImplicitView怎麽用?PHP Application::useImplicitView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phalcon\Mvc\Application
的用法示例。
在下文中一共展示了Application::useImplicitView方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createMvcFrom
/**
* @param array $config
* @return MvcApplication
*/
public static function createMvcFrom(array $config) : MvcApplication
{
$di = Di::createMvcFrom($config);
$application = new MvcApplication($di);
if ($di->has('applicationEventManager')) {
$application->setEventsManager($di->getShared('applicationEventManager'));
}
$application->useImplicitView(isset($config['view']));
return $application;
}
示例2: initApplication
protected function initApplication()
{
$di = $this->getDI();
if (!$this->getUserOption('app') instanceof Application) {
$this->setUserOption('app', new Application());
}
$this->app = $this->getUserOption('app');
$this->app->setDI($di);
$this->app->setEventsManager($di->get('eventsManager'));
// disable implicit views if using simple views
if ($di->has('view') && !$di->get('view') instanceof ViewInterface) {
$this->app->useImplicitView(false);
}
$di->setShared('app', $this->app);
if (!defined('APP_ENV')) {
define('APP_ENV', getenv('APP_ENV') ?: static::ENV_PRODUCTION);
}
}
示例3: Application
<?php
use Phalcon\Mvc\Application;
/**
* This file deals with the creation of the Application class,
* It allows seperation so we can inject the application inside tests as
* well as using it for its usual purpose.
*
*/
$container = (require_once __DIR__ . '/environment.php');
$application = new Application($container);
// Use explicit views
$application->useImplicitView(false);
/**
* Register the modules
*
*/
$mods = $container->get('modules');
$application->registerModules($mods);
return $application;
示例4: applicationSetup
/**
* Setup the phalcon application.
*
* @param null $uri
* @return string
*/
protected function applicationSetup($uri = null)
{
$app = new Application($this->di);
$app->useImplicitView('null' === $this->config['view']['default'] ? false : true);
// set event manager for application
$eventManager = $app->getDI()->getShared('eventsManager');
$this->setEventsManager($eventManager);
$this->registerEvents();
/*
* TODO This is bug on phalcon 2.0.4
*/
$app->setEventsManager($this->getEventsManager());
return $app->handle($uri)->getContent();
}
示例5: catch
$eventsManager = $app->di->get(AppServices::EVENTS_MANAGER);
$app->dispatcher->setEventsManager($eventsManager);
$router = $app->di->get(AppServices::ROUTER);
/**
* Attach plugins, components, modules to app
*/
include APP_PATH . 'Config/middleware.php';
include APP_PATH . 'Config/routes.php';
$modules = (include APP_PATH . 'Config/modules.php');
if (count($modules) > 0) {
$app->registerModules($modules);
}
/**
* Disable automatic rendering
*/
$app->useImplicitView(false);
/**
* Start application
*/
$app->handle();
/**
* Set content
*/
$returnedValue = $app->dispatcher->getReturnedValue();
if ($returnedValue !== null && !is_string($returnedValue)) {
$app->response->setJsonContent($returnedValue);
}
$response = $app->response;
} catch (\Exception $e) {
$response = $di->get(AppServices::RESPONSE);
$response->setErrorContent($e, $config->debug);