Yii2:如何在PHP的URL中使用连字符/破折号?

时间:2019-02-15 17:42:21

标签: php yii2 hyphen

我在 _form.php 文件中具有此按钮。

'buttons' => [
    'replace' => function($url, $model) {
        return Html::a(
            'Replace',
            [
                '/european-countries/replace',
                'countryIdReplacement' => '123' // Problem here.
            ]
        );
    },
],

我的控制器:

public function actionReplace($countryIdReplacement) {
    // My code.
}

URL为:

http://my-site/european-countries/replace?countryIdReplacement=123

我想使用这种可变格式:

http://my-site/european-countries/replace?country-id-replacement=123

但是PHP不允许使用该格式。这是不允许的:

actionReplace($country-id-replacement)

0 个答案:

没有答案