I have experiance this a few times any to fix I either toggle air plane mode on and then back off or I would simply restart device and this usually resolves this issue.
It seems something in your phone settings has become corrupt. I would recommend performing a hard reset to clear this up. The instructions to performing the reset are listed below:
Performing a factory reset via settings
The most convenient way to do a factory reset is via the phone settings.
then tap Settings.
Scroll down the screen,
and then tap Privacy
> Factory data reset.
On the Factory data reset screen,
tap Reset phone,
and then tap Erase everything.
Once you have done this it should resolve your issue and your wifi should begin to work correctly. Hope this helps.