网址:http://localhost/eg_integration/api/web/v1/devices/cacf090690d9dab14df06219ac36b3cd/registrations/pass.usa.gift?passesUpdatedSince=1232
主机:http://localhost/eg_integration/api/web/v1控制器:设备常量术语:注册,passesUpdatedSince
Url规则代码:
'class' => 'yii\rest\UrlRule',
'controller' => 'v1/devices',
'pluralize' => false,
'extraPatterns' => [
'GET registration' => 'getserialnumber',
]在extrapattern中热处理此url
发布于 2016-04-25 02:34:43
假设url是常量,我会设置如下规则:
'GET cacf090690d9dab14df06219ac36b3cd/registrations/pass.usa.gift' => 'getserialnumber',然后在您的deviceController中获得查询参数:
public function actionGetserialnumber() {
...
$value = Yii::$app->getRequest()->getQueryParam('passesUpdatedSince', $defaultValue)
...
}https://stackoverflow.com/questions/36811842
复制相似问题