为了账号安全,请及时绑定邮箱和手机立即绑定

F3 路由和动态参数(验证用户注册)

F3 路由和动态参数(验证用户注册)

PHP
郎朗坤 2022-10-22 16:17:21
我尝试使用 fatfree 框架来完成验证用户注册。    1. user registers account on: website/register    2. I save the user data including a verification key    3. he gets an email sent to the email he provided    4. the email contains the link (http://website/register/verify.php?vkey=$vkey) for verification     5. user clicks the link and gets sent to website/register/verify.php?vkey=91cb65b234b0b5d67df68e0d7f72ed7e    6. on the website I check if isset a verification key, and    7. get the verification key stored in db and compare it with ?vkey=$vkey    8. if they match, all good, reroute测试结果:    Not Found    HTTP 404 (GET ../register/verify.php?vkey=91cb65b234b0b5d67df68e0d7f72ed7e)我如何在路由中管理它?我尝试了什么:    $f3->route('GET /register/verify/@vkey', 'Controller\UserController->registerverified');    $f3->route('GET /register/verify.php?vkey=', 'Controller\UserController->registerverified');我很困惑,由于参数显然是动态的,如何设置路线?或者有没有其他方法可以验证注册/他来自发送给他的电子邮件中的正确链接?
查看完整描述

1 回答

?
心有法竹

TA贡献1866条经验 获得超5个赞

在一些帮助下弄清楚了:

    $f3->route('GET /register/verify/@vkey', 'Controller\UserController->registerverified');

然后检查是否 isset

    $params['vkey']


查看完整回答
反对 回复 2022-10-22
  • 1 回答
  • 0 关注
  • 70 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信