php - Laravel 从链接路由中获取 OTP 和电话
问题描述
在登录页面中,我从用户那里获取电话号码,并向 POST 方法中的号码发送 otp 代码。这是我的登录表单按钮:
<button type="submit" formaction="{{url('/client-mobile-login')}}" class="mobile-login__button">CONTINUE
</button>
这是我的路线:
Route::post('/client-mobile-login', 'ClientLoginController@client_mobile_login');
这是我的控制器功能:
public function client_mobile_login(Request $request)
{
...otp code here...(otp sending successfully)
.....
if($output){
return redirect("otp/".base64_encode($otp).'/'.base64_encode($client_phone1));
}
发送 otp 后,我想在链接上查看带有编码 otp 和电话号码的 otp 页面。这是我的 otp 路线。
Route::get('/otp/{otp}/{phone_number}', 'ClientLoginController@get_otp');
这是getotp函数
public function get_otp(Request $otp = NULL,$phone_number = NULL){
if ($otp != NULL AND $phone_number != NULL) {
$data['otp'] = $otp;
$data['phone_number'] = $phone_number;
return view('otp',compact('data'));
}
}
我在地址栏中获取链接,但未呈现 otp 页面
解决方案
推荐阅读
- python - 如何访问xml标签的父属性?
- vba - 当我收到运行时错误 91 对象变量或未设置块变量时该怎么办
- c++ - 删除上下文属性中的 QList 对象时,Qt QML 应用程序崩溃
- erlang - 只写了一个测试函数,报参数错误
- sql-server - 触发器中的保存点
- python - 获取孩子的完整标签名称
- c# - 无法通过 axios 执行 post 请求
- java - 过滤文件类型搜索和删除java
- angular - 在角度材料工具栏中放置主页链接
- java - 线程“restartedMain”中的异常 java.lang.reflect.InvocationTargetException