我目前正在尝试在简单的类中验证som字符串:
class followup
{
/**
*@url POST {varCvr}
*
*@param string $varText {@from path}
*@param string $datTask {@from path}{@type datetime}
*@param string $datRemind {@from path}{@type datetime}
*
*/
function post($varCvr, $varText, $datTask, $datRemind)
{ ......
当我尝试POST到https://MyHost/followup/DK26851300?varText=Test&datTask=2015-12-04 14:20:07& datRemind = 2015-12-11 11:00:00 (是URL_encoded,只是为了人类可读)我得到以下响应:
{
"error": {
"code": 400,
"message": "Bad Request: Invalid value specified for `varText`. Expecting date and time in `YYYY-MM-DD HH:MM:SS` format, such as `2015-12-07 15:34:52`"
},
"debug": {
"source": "Validator.php:430 at validate stage",
"stages": {
"success": [
"get",
"route",
"negotiate"
],
"failure": [
"validate",
"message"
]
}
}
}
这是什么原因?谢谢你的帮助!
答案 0 :(得分:0)
我在将@param添加到第一个变量时解决了这个问题:
/**
*@url POST {varCvr}
*@param string $varCvr {@from path}
*@param string $varText {@from path}
*@param string $datTask {@from path}{@type datetime}
*@param string $datRemind {@from path}{@type datetime}
*
*/