In PHP under the yii2 framework, how to provide an interface for SMS verification registration and SMS password retrieval for iOS?

WBOY
Release: 2016-08-23 09:17:52
Original
1430 people have browsed it

Now we need to provide interfaces for ios, one is SMS verification registration, and the other is SMS password retrieval. I don't know how to deal with it, can anyone give me some guidance? Thank you very much, I am doing the project under the yii2 framework

Reply content:

Now we need to provide interfaces for ios, one is SMS verification registration, and the other is SMS password retrieval. I don't know how to deal with it, can anyone give me some guidance? Thank you very much, I am doing the project under the yii2 framework

Does this have anything to do with the framework?

  • SMS verification registration: rand(0,999999) generates a random number and calls the third-party SMS sending interface to send the verification code. The verification code is successfully sent and dropped into DB. Verify this code when registering

  • Retrieve password: Same as above, is retrieving password actually a password reset?

Send SMS interface

<code>public function actionSendsms($phone){
    1.验证手机号码是否合法
    2.缓存检测短信发送频率(1分钟一条)
    3.生成验证码,写入缓存(缓存1,有效期3分钟)
    4.设置缓存,有效期1分钟(与第2条对应)
    5.返回发送成功的JSON
}

public function actionCheckcode($phone,$code){
    1.读取第3步的缓存,如果不存在,报错“验证码过期”
    2.如果验证码错误,报错“验证码错误”
    3.通过验证
}</code>
Copy after login

Speaker, in fact, the two functions you mentioned are very different from those on the PC. The difference lies in the returned data. You should have done it on PC! The user submits the form and you use PHP to receive the corresponding parameters, then perform logical processing, and then throw them to the page to give the user a prompt. The interface is just to return the data you process to the client. It is the same no matter what framework. As long as you provide a link to the client, this link is your interface

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
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!