Positional parameters cannot be used after named parameters |yiyi2
P粉158473780
P粉158473780 2024-03-26 14:44:20
0
1
439

I am taking the Yii2 PHP framework course and I encountered a problem. I'm not very familiar with PHP so I'm having a hard time figuring this out.

So I tried to create a "Delete" button in my website but I got the error: "Cannot use positional parameters after named parameters".

There are code snippets:

'class' => 'yii\grid\ActionColumn',
'buttons' => [
    'delete' => function ($url) {
        return Html::a(text:'Delete', $url, [
            'data-method' => 'post'
        ]);
    }
]

P粉158473780
P粉158473780

reply all(1)
P粉333186285

This is not a Yii2 issue, if you check the php documentation page it talks about this case, it says:

This makes sense, if PHP lets you put named parameters first and then positional parameters, there's no way to determine which parameters should match the unnamed parameters you actually pass.

In the opposite case, the first positional argument root

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template