PHP Restler API 使用@type 进行多参数输入验证

PHP Restler API inputvalidation with multiple params using @type

我目前正在尝试以简单的方式验证 som 字符串 class:

  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"
        ]
    }
}

}

这是什么原因?感谢您的帮助!

我在将@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}
*
*/