csrf in CodeIgniter 4

CSRF/csrf in ci4

  1. Enable CSRF:
    Go to app/Config/Filters.php 
    Search for public array $methods and replace with:

     
  2. Use (Just paste under <from>) :
    <input type=”hidden” name=”<?= csrf_token() ?>” value=”<?= csrf_hash() ?>” />

     

Leave a Reply

Your email address will not be published. Required fields are marked *