我无法使用复数选项访问默认端点,查看操作也不起作用
案例一: 不配置模块访问
'controllerNamespace' => 'api\controllers',
...
'rules' => [
[
'class' => 'yii\rest\UrlRule',
'controller' => 'country',
'tokens' => [
'{id}' => '<id:\\w+>'
],
/*'pluralize'=>false,*/
],
]
http://localhost/api/web/countries 不工作
http://localhost/api/web/country工作正常
http://localhost/api/web/country/1不工作
案例 2: 通过模块v1访问
'modules' => [
'v1' => [
'basePath' => '@app/modules/v1',
'class' => 'api\modules\v1\Module'
]
],
...
'rules' => [
[
'class' => 'yii\rest\UrlRule',
'controller' => ['country' => 'v1/country'],
'tokens' => [
'{id}' => '<id:\\w+>'
],
],
]
'pluralize' 没有完全工作,当访问
v1/country和v1/country/12时,两者都给出与索引操作相同的结果(国家列表)