php - Laravel 6.x VerifiesEmails.php 以 $request->route('hash') 失败,通过 $request->get('hash')
问题描述
在\Illuminate\Foundation\Auth\VerifiesEmails.php
,第 39 行失败$request->route('hash')
,但通过$request->get('hash')
。我不确定这是否是一个错误,但我没有看到我所做的任何事情都会以某种方式破坏这个功能。我也没有VerificationController.php
从核心修改我的文件。
上述$request->route('id')
方法可行,但是在该路由中传递的 ID 不是参数,而是直接在路径中,而哈希附加为?hash=myhash。
供参考,这是我的网址:http://localhost:8000/email/verify/8edd16a5-ad04-4782-b0fe-33f0f482d080?expires=myexpiryhere&hash=myhashhere&signature=mysignaturehere
谁能向我解释如何让这个工作?显然,修改供应商文件不是一种选择。我在这里的 Laravel 问题中发布了这个,但被指示可能我忘记了路由参数的建议。URL 是由框架生成的,所以我不知道我可能会忘记什么参数。
解决方案
这是我的错,但感谢 Chin Leung 提出了正确的问题。
我目前的路线是:
Route::get('email/verify', [VerificationController::class, 'show'])->name('verification.notice');
Route::get('email/verify/{id}', [VerificationController::class, 'verify'])->name('verification.verify');
Route::post('email/resend', [VerificationController::class, 'resend'])->name('verification.resend');
我自己指定它们,因为我不在路由文件中使用默认命名空间,我直接导入控制器以使重构更容易。看起来verification.verify
后来在路由中添加了一个新参数,所以现在应该是email/verify/{id}/{hash}
推荐阅读
- android - 当对象为空时,何时使用 let/run/apply/with/also?
- java - Kotlin 中运算符 :: 的模拟
- sql - 需要了解 pl/sql 中的所有内容
- python - Python 程序给我 StopIteration
- python - 在python中动态访问变量
- linux - 列出写入文件的文件夹的子文件夹
- roku - 在 Roku 上将 4:3 视频拉伸并显示为 16:9 宽高比
- python - 链接错误 - 无法在 Windows 中构建 Python C 扩展
- c++ - 如何用c ++从文本中选择一个句子
- excel - 在 Range 对象中找不到 VBA SpecialCells 属性