Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter get_csrf_hash()返回空_Php_Mysql_Codeigniter_Validation_Codeigniter 3 - Fatal编程技术网

Php Codeigniter get_csrf_hash()返回空

Php Codeigniter get_csrf_hash()返回空,php,mysql,codeigniter,validation,codeigniter-3,Php,Mysql,Codeigniter,Validation,Codeigniter 3,我试着用来解释,因为我想在这个框架上实现任何好的功能,以避免我的站点受到SQL注入和黑客的恶意攻击 问题: 为什么当我尝试回显或打印\u rget\u csrf\u hash()时,它什么也没有出现 我的当前代码 我的控制器 <?php class Myclass extends CI_Controller { function __construct() { parent::__construct(); $this->load->library

我试着用来解释,因为我想在这个框架上实现任何好的功能,以避免我的站点受到SQL注入和黑客的恶意攻击


问题:

为什么当我尝试回显或打印\u r
get\u csrf\u hash()
时,它什么也没有出现


我的当前代码

我的控制器

<?php

class Myclass extends CI_Controller {

  function __construct() {

    parent::__construct();

    $this->load->library('session');
    $this->load->helper('security');
    $this->load->helper('form');

    $this->my_simple_login->chek_login();

  }

  public function index(){

     $this->load->view('/myform');

  } // end index function (show form)

  function submit_form(){

    print_r( $this->input->post('my_input') ); // YEAH

    print_r( $this->input->post('csrf_test_name') ); //empty??

    print_r( $this->security->get_csrf_hash() ); //empty??

  } //end form submitted

} // end class

这个问题已经解决了。这是因为我没有在Codeigniter配置文件中将
TRUE
设置为
$config['global\u xss\u filtering']

$config['global_xss_filtering'] = TRUE;

这个问题已经解决了。这是因为我没有在Codeigniter配置文件中将
TRUE
设置为
$config['global\u xss\u filtering']

$config['global_xss_filtering'] = TRUE;

如果您使用form_open_multipart CSRF,它会自动生成,您不需要创建另一个CSRF输入,这意味着,即使我没有创建CSRF输入,它也可以工作。但是为什么
get\u csrf\u hash()
不返回任何内容(无论我的表单上是否有csrf输入)@Wolfgang1983如果您使用form_open_multipart CSRF,它是自动生成的,您不需要创建另一个CSRF输入,这意味着,即使我没有创建CSRF输入,它也可以工作。但是为什么
get\u csrf\u hash()
不返回任何内容(无论我的表单上是否有csrf输入)@沃尔夫冈1983
$config['global_xss_filtering'] = TRUE;