1: The use of ngrok is based on windows
1: Why use ngrok
When developing WeChat, you need to fill in the url connected to the WeChat server. This url must be an external network domain name,
that is to say We need to develop on the IP server corresponding to this external domain name, but there is no way to develop and debug locally
So we use ngrok to obtain an external domain name. This external domain name actually accesses the local host
In this way, the external domain name is Fill in the external network URL required by WeChat and you can develop and debug locally
2: Download ngrok ngrok - secure introspectable tunnels to localhost windows version
3: Register ngrok to get your auth token. The custom domain name behind it must be To have this token
4: Open cmd cd to the directory where ngrok.exe is located, execute ngrok 80, and you can assign a domain name to 127.0.0.1:80 of your local machine that can be accessed by the external network, such as http://1f1b1c. ngrok.com
That is, accessing http://1f1b1c.ngrok.com from the external network will access 127.0.0.1:80 of your local machine. Of course, if you execute ngrok 8080, it will assign a domain name to access 127.0.0.1:8080
5: The domain name assigned above is temporary. It may change next time you turn on the computer. We need a fixed domain name mapped to port 80 of the local machine.
So log in first and execute ngrok -authtoken XUsFLvG4hgb8ukjvML8YBXX 80. Fill in here is the token given to you when you registered,
Then ngrok -subdomain myapp 80 so that you can always access 127.0.0.1:80 of this machine through http://myapp.ngrok.com
Of course If you want to access port 8080, then change the above 80 to 8080
6: Do not close the cmd window. After closing the cmd window, the domain name provided will not be accessible. If you want to view the relay http information ngrok has done for you, access http: //localhost:4040/
7: When it comes to WeChat development, you must pay attention to the fact that ngrok does the transfer for security reasons and cannot pass WeChat's default statement libxml_disable_entity_loader(true);
, so comment it out and wait for the official Deploy to the server and uncomment
For more articles on how to do local debugging in WeChat development, please pay attention to the PHP Chinese website!