从其他网站发布到我的Laravel的网站,并获得302错误
问题描述:
我有一个核心PHP的网站,并从那里我试图将数据发布到我的laravel网站,但得到一个302从其他网站发布到我的Laravel的网站,并获得302错误
我的PHP形式
<form name="frm_payInternational" action="https://abcd.com/international" method="post">
<input type="hidden" value="">
<div style="margin-bottom:15px;">
<input name="paymentInterEmail" id="paymentInterEmail" placeholder="Enter Email Id" style="width:400px;height:30px;border-radius:5px;" >
</div>
<div style="margin-bottom:15px;">
<input name="paymentInterAmt" id="paymentInterAmt" placeholder="Enter Amount" style="width:400px;height:30px;border-radius:5px;" >
</div>
<div style="margin-bottom:15px;">
<button type="submit" name="btn_makePaymentInter" id="btn_makePaymentInter" class="btn">Make Payment</button>
</div>
</form>
我routes.php文件代码
// Payment Link
Route::post('/international', '[email protected]');
答
我刚加入VerifyCsrfToekn.php中间件路线
protected $except = [
"route_name"
];
这不是理想的,但只是想暂时解决问题
+0
不,不要这样做。这是做什么的,它跳过检查这条路线的csrf标记,你不想这样做。在'
+0
但其他网站不在Laravel –
+0
啊好的,如果是这样,那么你做的是正确的。 [更多信息](https://laravel.com/docs/5.4/csrf#csrf-excluding-uris) – Fahmi
302不是一个错误,而是一个重定向。它试图将你重定向到哪里?并且:很多网站会在发布后进行重定向,以避免浏览器询问用户是否希望在历史导航中重新发布其值。 – Wrikken
它将我重新定向到我发布此表单的同一页面..我猜测它需要一个csrf_token但不知道如何传递它 –