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


PHP App::__construct方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $containerBuilder = new ContainerBuilder();
     $containerBuilder->addDefinitions(__DIR__ . '/config.php');
     $container = $containerBuilder->build();
     parent::__construct($container);
 }
开发者ID:vonalbert,项目名称:Slim-Bridge,代码行数:7,代码来源:App.php

示例2: __construct

 /**
  * Shiniwork constructor.
  *
  * @param array $settings
  */
 public function __construct(array $settings = [])
 {
     session_start();
     $container = new Settings($settings);
     parent::__construct($container);
     $this->registerView()->registerDatabase()->registerMailer()->registerJWT()->addJWTMiddleware();
 }
开发者ID:ShiniWolf,项目名称:shiniwork,代码行数:12,代码来源:Shiniwork.php

示例3: __construct

 /**
  *
  * @param array $routes
  * @param unknown $options
  */
 public function __construct(array $routes, $options = null)
 {
     parent::__construct($options);
     $this->container = $this->getContainer();
     $this->_routes = $routes;
     $this->resolve();
 }
开发者ID:renatoaraujo,项目名称:slim-skeleton,代码行数:12,代码来源:Bootstrap.php

示例4: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct(Container $container = null)
 {
     $container = $container ?: new Container();
     $container->delegate(new ReflectionContainer());
     $container->addServiceProvider(new SlimServiceProvider());
     parent::__construct($container);
 }
开发者ID:jenssegers,项目名称:lean,代码行数:10,代码来源:App.php

示例5: __construct

 /**
  * App constructor.
  *
  * @param $basePath
  */
 public function __construct($basePath)
 {
     $this->setBasePath($basePath);
     $this->init();
     $container = new SlimContainer();
     parent::__construct($container);
     self::$instance = $this;
 }
开发者ID:pongtan,项目名称:framework,代码行数:13,代码来源:App.php

示例6: __construct

 /**
  * @param ContainerInterface|array $container
  */
 public function __construct($container = [])
 {
     parent::__construct($container);
     $this->getContainer()['app'] = function () {
         return $this;
     };
     $this->setupEnvData();
     $this->loadRoutes();
     $this->setupNotFound();
 }
开发者ID:rpastorelle,项目名称:php-react-boilerplate,代码行数:13,代码来源:Application.php

示例7: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($userSettings = [])
 {
     parent::__construct($userSettings);
     if ($userSettings['debug']) {
         $this->debug = $userSettings['debug'];
     }
     $this->config = Config::getInstance();
     $this->registerHandlers();
     $this->registerServices();
 }
开发者ID:thecodeassassin,项目名称:hatchup,代码行数:13,代码来源:App.php

示例8: __construct

 /**
  * Create a new application.
  *
  * @param string $basePath
  */
 public function __construct($basePath)
 {
     if (is_null($basePath)) {
         throw new \InvalidArgumentException("The base path has not been set.");
     }
     parent::__construct();
     // Make the container instance used by this application
     // globally available.
     Container::setInstance($this->getContainer());
     $this->setBasePath($basePath);
     $this->bootstrap();
 }
开发者ID:bvqbao,项目名称:app-skeleton,代码行数:17,代码来源:Application.php

示例9: __construct

 /**
  * @param ContainerInterface|array $container
  */
 public function __construct($container = [])
 {
     parent::__construct($container);
     $this->getContainer()['app'] = function () {
         return $this;
     };
     $this->setupServices();
     $this->setupEnvData();
     $this->loadRoutes();
     $this->setupNotFound();
     $this->setupErrorHandler();
     Model::setApp($this);
 }
开发者ID:rpastorelle,项目名称:howfastdoyoutype,代码行数:16,代码来源:Application.php

示例10: __construct

 public function __construct($container = null)
 {
     parent::__construct($container);
     $this->loadDI();
     $this->loadPlugins();
 }
开发者ID:tyurderi,项目名称:slim-mvc,代码行数:6,代码来源:App.php

示例11: __construct

 /**
  * @param array|\Interop\Container\ContainerInterface $config
  * @param $debug
  */
 public function __construct($config, $debug)
 {
     $config['displayErrorDetails'] = $debug;
     parent::__construct(['settings' => $config]);
 }
开发者ID:EugeneKirillov,项目名称:organization-relationships,代码行数:9,代码来源:App.php

示例12: array

 function __construct($settings)
 {
     parent::__construct($settings);
     $more = array();
     self::$instance = $this;
 }
开发者ID:senegalesegirl,项目名称:CrowdHelp,代码行数:6,代码来源:index.php

示例13: __construct

 public function __construct($container = [])
 {
     parent::__construct($container);
     $this->setUpRoutes();
     $this->setupRenderer();
 }
开发者ID:takkyuuplayer,项目名称:hackyou,代码行数:6,代码来源:App.php

示例14: __construct

 /**
  * Constructor
  *
  * @param array|ContainerInterface $container Instancia de Container o array de configuración. Default: []
  */
 public function __construct($container = [])
 {
     parent::__construct($container);
     $this->registerDafaultServicesProvider();
     $this->registerServiceProviders();
 }
开发者ID:restyphp,项目名称:resty,代码行数:11,代码来源:Api.php

示例15: __construct

 /**
  * @internal
  */
 public function __construct($userSettings = null)
 {
     $configDir = '.';
     // Пользовательские настройки
     // --------------------------
     if (!is_array($userSettings)) {
         $userSettings = array('file' => $userSettings);
     }
     if ($file = @$userSettings['file']) {
         unset($userSettings['file']);
         if (file_exists($file)) {
             $configDir = dirname($file);
             $settings = Utils::loadConfig($file);
             Log::debug("Configuration load: " . realpath($file));
             unset($file);
             $userSettings = array_merge($userSettings, $settings);
         }
     }
     $userSettings = array_merge($this->defaultsSettings, $userSettings);
     if ($p = $userSettings['templates.path']) {
         if (substr($p, 0, 1) !== '/') {
             $userSettings['templates.path'] = SYSPATH . '/' . $p;
         }
     }
     // if (is_array($userSettings['import'])) {
     //     $import = $userSettings['import'];
     //     foreach ($import as $file) {
     //         $file     = $configDir . '/' . $file;
     //         $settings = Utils::loadConfig($file);
     //         if ($settings) {
     //             $defaultSettings = array_merge($defaultSettings, $settings);
     //             Log::debug("Configuration import",
     //                               array(realpath($file)));
     //         }
     //     }
     // }
     parent::__construct((array) $userSettings);
     $app =& $this;
     // Если Internet Explorer, то шлем на хуй
     /*
      if (preg_match('/(rv:11.0|MSIE)/i', $_SERVER['HTTP_USER_AGENT'])) {
      $app->log->warning('Bad Browser ', array('HTTP_USER_AGENT'=>$_SERVER['HTTP_USER_AGENT']));
      $app->redirect( "http://fobia.github.io/docs/badbrowser.html" );
      exit();
      }
     */
     // // Автоматическая загрузка секций конфигурации
     // ----------------------------------------------
     $autoload = $this['settings']['app.autoload'];
     if ($autoload) {
         $this['settings']['app'] = new \Pimple();
         $this['settings']['app']['autoload'] = $autoload;
         if (is_array($autoload)) {
             foreach (@$autoload as $cfg => $file) {
                 $this['settings']['app'][$cfg] = function ($c) use($cfg, $file, $configDir) {
                     Log::debug(">> autoload config", array($cfg, $file));
                     if (!file_exists($configDir . "/{$file}")) {
                         trigger_error("Нет автозагрузочной секции конфигурации '{$cfg}'" . "/{$file}", E_USER_ERROR);
                         return;
                     }
                     return Utils::loadConfig($file);
                 };
             }
         }
     }
     unset($autoload, $cfg, $file);
     // Session
     //  session.gc_maxlifetime = 1440
     //  ;setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
     // ------------------
     $this['session'] = function ($c) {
         $sid = null;
         if ($c['settings']['session.cookie'] && @$_COOKIE['SID']) {
             $sid = $_COOKIE['SID'];
             session_id($sid);
         }
         $session = new \Slim\Session($c['settings']['session.handler']);
         @$session->start();
         if ($c['settings']['session.encrypt'] === true) {
             $session->decrypt($c['crypt']);
         }
         if ($sid === null) {
             $sid = session_id();
             if ($c['settings']['session.cookie']) {
                 @$c->setCookie('SID', $sid, time() + 1440);
                 Log::debug('Session save cookie');
             }
         }
         Log::debug('Session start', array($sid));
         return $session;
     };
     // View
     // ------------------
     $this['view'] = function ($c) {
         $view = $c['settings']['view'];
         if ($view instanceof \Slim\Interfaces\ViewInterface !== false) {
             return $view;
//.........这里部分代码省略.........
开发者ID:fobiaweb,项目名称:base,代码行数:101,代码来源:Application.php


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