php - Yii2:如何在 PHP 的 url 中使用连字符/破折号?
问题描述
我在_form.php文件中有这个按钮。
'buttons' => [
'replace' => function($url, $model) {
return Html::a(
'Replace',
[
'/european-countries/replace',
'countryIdReplacement' => '123' // Problem here.
]
);
},
],
我的控制器:
public function actionReplace($countryIdReplacement) {
// My code.
}
网址是:
http://my-site/european-countries/replace?countryIdReplacement=123
我想使用这种变量格式:
http://my-site/european-countries/replace?country-id-replacement=123
但是 PHP 不允许使用这种格式。这是不允许的:
actionReplace($country-id-replacement)