【发布时间】:2019-05-03 03:15:39
【问题描述】:
在我看来(list.blade.php)我有(下面只显示相关部分)
<?php $counter=0; ?>
@foreach($items as $item)
<button type="button" class="addButton btn btn-default" onclick="document.getElementById({{$counter}}).submit()">
<i class="fa fa-close"></i>
<form id="{{$counter}}" action="{{ URL::route('list.remove') }}" method="POST" style="display: none;">
<input type="hidden" name="item" value="{{$item->item}}"></input>
@csrf
</form>
<?php $counter++;?>
@endforeach
web.php中的相关控制器:
Route::post('/list/remove', 'listController@removeItem')->name('list.remove')->middleware('auth');
我在listController.php中的函数(目前只是一个测试函数):
public function removeItem(){
echo "hello";
}
当您单击 list.blade.php 中的按钮时,您会被发送到显示
的页面错误 419 抱歉,您的会话已过期。请刷新并尝试 再次。
【问题讨论】: