How to encapsulate the code for WeChat development curl to perform WeChat interface operations?
LRTRL
LRTRL 2017-05-18 11:10:37
0
2
1101

Hello everyone, when I was doing WeChat development, I encapsulated a curl method according to the teacher's video to operate the WeChat interface, but there was a problem during the actual operation. When calling this Before the method, all data can be output normally, but after calling this method, the data cannot be output, and the report is: "errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [7Gvnoa0808vr46 !]" error, could you please help me find out if there is anything wrong with the curl method I wrote? Why does it report an error as soon as it is executed?


LRTRL
LRTRL

像蜗牛一样爬行,坚信总有一天我会有属于自己的一片天!

reply all (2)
美食控

First make sure the appid and secret are correct, and then check whether the access_token exceeds the request limit (up to 2000 times a day). It is best to add the access_token request to the cache or SESSION, otherwise the upper limit will be reached after just testing in one day

  • reply The appid and appsecret are both correct, and I put the obtained access_token in the database, which will be judged before calling; but how do I put it in the session? I also put it in the session before, but other interfaces call this During the session, the value cannot be obtained.
    LRTRL author 2017-05-26 16:11:05
  • reply Your other interface calls will definitely not work, and you must request the token again.
Ty80

The token is cached. It may be that two tokens are generated locally and online, causing one to expire

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!