[英]F3 route and dynamic parameter (verify user registration)
I try to accomplish verifying a user registration, using fatfree framework.我尝试使用 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
test result:测试结果:
Not Found
HTTP 404 (GET ../register/verify.php?vkey=91cb65b234b0b5d67df68e0d7f72ed7e)
How do I manage that in routing?我如何在路由中管理它?
What I tried:我试过的:
$f3->route('GET /register/verify/@vkey', 'Controller\UserController->registerverified');
$f3->route('GET /register/verify.php?vkey=', 'Controller\UserController->registerverified');
I`m confused, how to set the route since the paramater is dynamic obviously?我很困惑,由于参数显然是动态的,如何设置路由? Or is there any other way how to verify the registration / that he comes from the right link within the email sent to him?
或者有没有其他方法可以验证注册/他来自发送给他的电子邮件中的正确链接?
Thanks!谢谢!
Got it figured out with some help:在一些帮助下弄清楚了:
$f3->route('GET /register/verify/@vkey', 'Controller\UserController->registerverified');
And then check if isset然后检查是否 isset
$params['vkey']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.