This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
对象概念在HTTP协议中不存在,也不能以请求作为对象发送数据。您可以将输入作为JSON对象获取并解码,但这将是 stdclass 对象。因此,您可以将请求数组分配给用户模型并将其用作对象。
例子:
假设您创建了
用户
模型,并且要将数组分配为属性。注意:最好在分配给用户对象之前验证输入。您可以使用表单请求
Object concept doesn't exist in HTTP protocol and you can't send your data with requests as an object. you can get the input as json object and decode it, but that will be a StdClass object. So, you can assign the request array to the user model and use it as an object.
Example:
Suppose you created a
User
model and you want to assign the array as an attribute.Note: It's better to validate the inputs before assign to the user object. you can do it clearly with Form Requests