簡體   English   中英

PHP Restler API使用@type的多個參數的inputvalidation

[英]PHP Restler API inputvalidation with multiple params using @type

我目前正在嘗試在一個簡單的類中驗證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)
    { ......

當我嘗試發布到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}
*
*/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM