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


PHP request::enable_super_globals方法代码示例

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


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

示例1: build_container

 /**
  * Build dependency injection container
  *
  * @throws \phpbb\install\exception\cannot_build_container_exception	When container cannot be built
  */
 protected function build_container()
 {
     // If the container has been already built just return.
     // Although this should never happen
     if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface) {
         return;
     }
     // Check whether container can be built
     // We need config.php for that so let's check if it has been set up yet
     if (!filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) {
         throw new cannot_build_container_exception();
     }
     $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext);
     $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext);
     // For BC with functions that we need during install
     global $phpbb_container, $table_prefix;
     $disable_super_globals = $this->request->super_globals_disabled();
     // This is needed because container_builder::get_env_parameters() uses $_SERVER
     if ($disable_super_globals) {
         $this->request->enable_super_globals();
     }
     $other_config_path = $this->phpbb_root_path . 'install/update/new/config';
     $config_path = is_dir($other_config_path) ? $other_config_path : $this->phpbb_root_path . 'config';
     $this->container = $phpbb_container_builder->with_environment('production')->with_config($phpbb_config_php_file)->with_config_path($config_path)->without_cache()->without_compiled_container()->get_container();
     // Setting request is required for the compatibility globals as those are generated from
     // this container
     $this->container->register('request')->setSynthetic(true);
     $this->container->set('request', $this->request);
     $this->container->register('language')->setSynthetic(true);
     $this->container->set('language', $this->language);
     // Replace cache service, as config gets cached, and we don't want that when we are installing
     if (!is_dir($other_config_path)) {
         $this->container->register('cache.driver')->setSynthetic(true);
         $this->container->set('cache.driver', new dummy());
     }
     $this->container->compile();
     $phpbb_container = $this->container;
     $table_prefix = $phpbb_config_php_file->get('table_prefix');
     // Restore super globals to previous state
     if ($disable_super_globals) {
         $this->request->disable_super_globals();
     }
     // Get compatibilty globals and constants
     $this->update_helper->include_file('includes/compatibility_globals.' . $this->php_ext);
     $this->update_helper->include_file('includes/constants.' . $this->php_ext);
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:51,代码来源:container_factory.php

示例2: tearDown

 /**
  * Makes sure super globals work properly after these tests
  */
 protected function tearDown()
 {
     $this->request->enable_super_globals();
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:7,代码来源:request_test.php


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