當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。