doupao1530
2017-02-25 15:11
浏览 66
已采纳

Body是json但request-> get()返回null

I posted an object from postman to controller with Laravel 5.2 but when i want to get an field with $request->get('receiver_name') response return null

postman screen shot :

enter image description here

图片转代码服务由CSDN问答提供 功能建议

我使用Laravel 5.2将一个对象从邮递员发布到控制器,但是当我想要一个带 $的字段时 request-> get('receiver_name')响应返回null

postman屏幕截图:

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyi8408 2017-02-26 22:52
    已采纳

    Your problem is caused by the value of the field "receiver_cell_phone" which is invalid, because it is a number starting with a zero.

    In short, in JSON leading zeros are not supporting. If you have a field that may have leading zeros, treat it as a string.

    Change your post field to:

    "receiver_cell_phone": "0983242342"
    
    点赞 打赏 评论

相关推荐 更多相似问题