The following tutorial column of thinkphp framework will introduce to you how thinkphp5 calls the cloud patch interface to realize the function of sending SMS verification code to retrieve the password. I hope it will be helpful to friends in need!
Idea:
1. The user enters the mobile phone number and requests to obtain the SMS verification code.
2. thinkphp generates the SMS verification code, stores it, and sends the request to Yunpian together with other parameters.
3. Yunpian sends a text message verification code to the designated mobile phone number.
4. The user enters the SMS verification code.
5. thinkphp determines whether the verification is passed based on two conditions: whether the verification code is correct and whether the verification code has expired.
Interface address: https://sms.yunpian.com/v1/sms/send.json
.
Use postman and enter the three necessary parameters apikey
, mobile
and text
.
Example:
1.html file:
##2.js file, implement asynchronous refresh and obtain the returned Information #3. Create a data table to store the verification code:The above is the detailed content of How thinkphp5 calls the cloud interface to implement the function of sending SMS verification code to retrieve password. For more information, please follow other related articles on the PHP Chinese website!