If you have confirmed that your oauth2 authorization url does not add http,
Please check that your redirect_uri has There is no http in front of the domain name! ! !
The code is as follows:
// 一定要检查你的redirect_uri $redirect = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=你的appID&redirect_uri=http://你的域名/get?id=18&response_type=code&scope=snsapi_base&state=1&connect_redirect=1#wechat_redirect';
Then, the problem is solved! I have been troubled for a long time and finally found that the solution is actually very simple. I hope it can help everyone.