我有一个疑问,我使用的是Laravel 5.8,我在Vue中有一个简单的注册表格组件。当我通过POST方法提交表单时,Laravel不要求我CSRF令牌,这是正常现象吗?我没有使用API路由。
我只是注意到Chrome存储中有一个XSRF-TOKEN。
那么,现在如何通过ajax进行CSRF验证?
我正在使用 Bootstrap 4 和 YII 2,我想自定义我的复选框输入,如下一个链接
https://getbootstrap.com/docs/4.0/components/forms/#checkboxes。
所以我正在使用该类yii\grid\CheckboxColumn,但我不知道该怎么做。
我尝试了以下方法
'columns' => [
[
'class' => 'yii\grid\CheckboxColumn',
'cssClass' => 'checkbox-select',
'headerOptions' => ['style' => 'width:5px'],
'header' => '<div class="custom-control custom-checkbox">'.Html::checkBox('selection_all', false, ['id' => 'customCheck1', 'type' => 'checkbox', 'class' => 'custom-control-input select-on-check-all']).'<label class="custom-control-label" for="customCheck1"></label></div>',
'checkboxOptions' => function($model){
return ['<div class="custom-control custom-checkbox">'.Html::checkBox('selection', false, ['id' => "'customCheck".$model->id."'", 'class' => 'custom-control-input']).'<label class="custom-control-label" for="customCheck'.$model->id.'"></label></div>'];
},
],
],
Run Code Online (Sandbox Code Playgroud)
它仅适用于表标题,不适用于其他复选框。