且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在我的网站上实施短信验证

更新时间:2023-12-02 14:52:52

只需将新表添加到数据库中存储密钥。如果您不想添加新表,则可能需要创建新列。在该列中,您应该存储将要发送的密钥以用于验证目的。



然后将密钥发送到他们的电话号码。您需要使用网关服务通过短信将消息发送到他们的手机。您可以使用Twilio等服务。 PHP只会用来使事情有效。



现在,如果您已完成我之前告诉您的事情(前2段),那么您只需要询问他们的电话号码,然后向他们发送验证码。验证就像验证一样。您将测试他们的电话号码和验证码,如果代码是当前的电话号码,那么您将验证他们的帐户流程。



一个好的例如: Build使用Twilio,PHP,MySQL和jQuery进行简单的电话验证 [ ^ ]
Just add a new table to the database to store the key. You may want to create a new column if you don't want to add a new table. In that column, you should store the key that is going to be sent for the verification purposes.

Then send the key to their phone numbers. You would need to use a gateway service to send the messages through SMS to their mobile phone. You can use services like Twilio or so on. PHP would just be used to make things work.

Now if you have done what I told you previously (in previous 2 paragraphs) then you are just going to ask them for their phone numbers and then send them a verification code. Verification is just like authentication. You are going to test their phone number and verification code, if the code is for the current phone number, then you are going to verify their account process.

A good example is: Build a Simple Phone Verification with Twilio, PHP, MySQL, and jQuery[^]