【发布时间】:2014-01-20 18:42:08
【问题描述】:
我有使用许多可选参数的服务:
/**
* Change user settings
*
* @smart-auto-routing false
* @url POST settings/
* @param string $name New name of the user {@min 2}{@max 64}
* @param string $surname New surname of the user {@min 2}{@max 64}
* @param bool $sex 0 for man, 1 for girl
* @param string $email New email address of the user {@type email}
* @param bool $emailing 1 if user want to receive email from ilerter, 0 else
* @param string $phone_number New phone number of the user {@min 4}
* @param int $height {@from body}
* @param int $weight {@from body}
* @param int $eyes_color {@from body}
* @param int $hair_color {@from body}
* @param string $avatar {@from body}
* @param string $description {@from body}
* @return bool
* @throws \Luracast\Restler\RestException
*/
public function settings($name, $surname, $sex, $email, $emailing, $phone_number,
$height = "", $weight = "", $eyes_color = "", $hair_color = "", $avatar = "",
$description = ""){
问题是当我决定在可选参数中只发送“头像”时,我的服务将其放入 $height 并返回
Bad Request: invalid value specified for `height`. Expecting integer value
当它不是第一个可选参数时,Restler 有没有办法捕捉唯一好的可选值?
【问题讨论】:
标签: php web-services optional-parameters phpdoc restler