codeigniter CSRF error: “The action you have requested is not allowed.”

后端 未结 14 2354
长发绾君心
长发绾君心 2020-11-28 12:57

I enabled the csrf_protection option in codeigniter\'s config file, and used form_open() function to create my forms. But when I submit the form, this error occurs:

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 13:11

    if you allow true in $config['csrf_protection'] = true; within config file and you are also add autoload form than we can use.

    Step 1. within config folder autoload file upload form helper

    $autoload['helper'] = array('url', 'file','form');
    

    Step 2.

    $config['csrf_protection'] = true; 
    

    Step 3. while uploading in view folder

    
    

    Otherwise, you can use only

    $config['csrf_protection'] = false;
    

提交回复
热议问题