【问题标题】:CodeIgniter: Custom Hmvc config File - csrfCodeIgniter:自定义 Hmvc 配置文件 - csrf
【发布时间】:2015-11-29 10:17:32
【问题描述】:

我正在使用 CI 2.1.4 和 HMVC,我遇到了安全类和配置文件的问题。 我在 app/config 文件夹中有 3 个带有自定义配置文件和默认 config.php 文件的模块。

application
   config
      config.php // Default security config 
          $config['global_xss_filtering'] = false;
          $config['csrf_protection'] = false;
          $config['csrf_token_name'] = 'xxx';
          $config['csrf_cookie_name'] = 'xxx';
          $config['csrf_expire'] = 7200;
   modules
      module_1
         config
            config.php // with this config
                $config['global_xss_filtering'] = true;
      module_2
         config
            config.php // with this config
                $config['global_xss_filtering'] = true;
                $config['csrf_protection'] = true;
                $config['csrf_token_name'] = 'yyy';
                $config['csrf_cookie_name'] = 'yyy';
                $config['csrf_expire'] = 7200;
      module_3
         config
            config.php // default config

但不起作用,配置文件不会被模块配置设置覆盖

【问题讨论】:

    标签: php codeigniter config hmvc csrf-protection


    【解决方案1】:

    hmm...可能是 HMVC 扩展中的错误,因为模块配置文件应该覆盖全局配置文件...无论如何,为了节省时间,您始终可以在调用 post 时将第二个参数添加到 TRUE 内联,这样您就可以确定应用了安全过滤器示例:

    $some_data= $this->input->post('some_data', TRUE);
    //the 2nd parameter (true) lets you run the data through the XSS filter.
    

    来源:https://ellislab.com/codeigniter/user-guide/libraries/input.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-11
      • 2014-01-15
      • 2016-10-25
      • 2015-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多