Skip to content

Conversation

@Tinywan
Copy link

@Tinywan Tinywan commented Jun 29, 2021

例如:

  • route 绑定参数: http://capi.train.tinywan.cn/h/v1/user/{{uid}}/info-save 请求地址: http://capi.train.tinywan.cn/h/v1/user/10478916/info-save
  • post param
{
    "10086": "Tinywan",
    "10000": "mobile"
}

定义方法

    /**
     * @param int $uid
     * @return Response
     */
    public function infoSave(int $uid): Response{}

最后的参数是:

array(3) {
    [
        0
    ]=>
  string(7) "Tinywan"
  [
        1
    ]=>
  string(6) "mobile"
  [
        "uid"
    ]=>
  string(8) "10478916"
}

最后传入的参数 infoSave(Tinywan)

错误信息

Argument 1 passed to app\\controller\\home\\v1\\User::infoSave() must be of the type int, string given

例如:
- route 绑定参数: `http://capi.train.tinywan.cn/h/v1/user/{{uid}}/info-save`  请求地址: `http://capi.train.tinywan.cn/h/v1/user/10478916/info-save`
- post param

```
{
    "10086": "Tinywan",
    "10000": "mobile"
}
```

定义方法
```
    /**
     * @param int $uid
     * @return Response
     */
    public function infoSave(int $uid): Response{}
```
最后的参数是:
```
array(3) {
    [
        0
    ]=>
  string(7) "Tinywan"
  [
        1
    ]=>
  string(6) "mobile"
  [
        "uid"
    ]=>
  string(8) "10478916"
}
```
最后传入的参数 `infoSave(Tinywan)`

错误信息
```
Argument 1 passed to app\\controller\\home\\v1\\User::infoSave() must be of the type int, string given
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant