We know that errors always occur when using callback mode to develop WeChat enterprise accounts, so this time we will bring you the solution to the error problem of callback mode in PHPPHP development, let’s take a look.
In fact, the WeChat development documentation is indeed very detailed, and using the official demo, you can use it directly as long as you make slight changes. But why does it always prompt an error?
Below I will first post the code for turning on the callback mode that I verified successfully
VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr); if ($errCode == 0) { echo $sEchoStr; // // 验证URL成功,将sEchoStr返回 // HttpUtils.SetResponce($sEchoStr); } else { print("ERR: " . $errCode . "\n\n"); }
It can be seen that the above code is basically the same as the one given in the demo. The same code was also verified unsuccessfully one day ago. Research has found that the domain name used when verifying the URL must be a trusted domain name. ps: I am using Sina Cloud, but I did not perform real-name authentication, so there is a risk. After I authenticated my real-name, it was successfully opened.
Enlightenment: Official documents are never wrong. It is necessary to study official documents carefully. In the process of turning on the callback mode of the WeChat enterprise account, it is also very important that the domain name must be a trusted domain name.
# I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
Examples to explain Ajax asynchronous request technology
What is the common syntax of AJAX
AJAX principles and CORS cross-domain methods
The above is the detailed content of PHP development about callback mode. For more information, please follow other related articles on the PHP Chinese website!