等待输入有效的短信代码。检查后,数据保存到数据库php
Wait for a valid sms code to be entered. After check it that, data Save to Databases php
你好,我的代码有问题
我想在用户输入短信代码发送到他的phone手机
后将数据保存在数据库中
我想在这里等待进程并保存数据我不想丢失它
用户输入短信代码后,我将所有数据保存在数据库中
public function registered(IdentityRequest $request) {
$response = Http::get(route('fake') , [
'national_id' => $request->input('national_id'),
'date_birth' => $request->input('date_birth')
]);
if($response['status'] == 200) {
// i saved the data here
$userInformation = $response['data'];
} else {
return $this->returnErrorResponse('E002', 'no user ', '404');
}
// send OTP verification after validate request of user
$otp = new Client(env('ENV_ACCOUNT_SID' , 'sid') , env('ENV_AUTH_TOKEN' , 'token));
$smsCode = rand(100000, 999999);
$message = $otp->messages->create("+".$request->input('phone') , [
"body" => $smsCode, // this code i send to user
"from" => "+11111"
]);
// here i want to whit untill user enter the code and i don't want to lose data
// from $request and $userInformation
// how i can do that
// after the user enter valid code sms and i check it from him
// i saved all the data in database
}
你不能那样做。
你必须分 2 个阶段和 4 个步骤完成
- 从用户那里获取信息,将其保存在文件或数据库等持久存储中
- 通过短信发送代码并将代码与用户信息一起保存
- 发送短信,并将用户重定向到另一个页面,因此 he/she 应该用电子邮件或 national_id 以及您发送给 her/him[=19= 的代码填写表格]
- 验证代码是否与用户信息匹配
你好,我的代码有问题 我想在用户输入短信代码发送到他的phone手机
后将数据保存在数据库中我想在这里等待进程并保存数据我不想丢失它 用户输入短信代码后,我将所有数据保存在数据库中
public function registered(IdentityRequest $request) {
$response = Http::get(route('fake') , [
'national_id' => $request->input('national_id'),
'date_birth' => $request->input('date_birth')
]);
if($response['status'] == 200) {
// i saved the data here
$userInformation = $response['data'];
} else {
return $this->returnErrorResponse('E002', 'no user ', '404');
}
// send OTP verification after validate request of user
$otp = new Client(env('ENV_ACCOUNT_SID' , 'sid') , env('ENV_AUTH_TOKEN' , 'token));
$smsCode = rand(100000, 999999);
$message = $otp->messages->create("+".$request->input('phone') , [
"body" => $smsCode, // this code i send to user
"from" => "+11111"
]);
// here i want to whit untill user enter the code and i don't want to lose data
// from $request and $userInformation
// how i can do that
// after the user enter valid code sms and i check it from him
// i saved all the data in database
}
你不能那样做。
你必须分 2 个阶段和 4 个步骤完成
- 从用户那里获取信息,将其保存在文件或数据库等持久存储中
- 通过短信发送代码并将代码与用户信息一起保存
- 发送短信,并将用户重定向到另一个页面,因此 he/she 应该用电子邮件或 national_id 以及您发送给 her/him[=19= 的代码填写表格]
- 验证代码是否与用户信息匹配