How to solve Invalid Form Key. Please refresh the page in Magento 2

If you get Invalid Form Key. Please refresh the page in the admin of Magento 2 then you need to increase the size of the max_input_vars, increase it to 10000

ini_set('max_input_vars', 10000);