0
votes

Am trying to logout uusing yii2 logout link but it returns an error of only method of post This is my code:

"btn btn-default btn-flat" ,'data-method' => 'post']); ?>
1

1 Answers

0
votes

you can use link for show a button, so you should use data as an array and in the array, first element must be method and the value of method is post :

<?= Html::a('label',['/site/logout'],['class'=>'btn btn-default btn-flat']),
            ['data' => ['method' => 'post',]])
?>