首页 > 编程语言 >ThinkPHP5错误解析之variable type error:array

ThinkPHP5错误解析之variable type error:array

时间:2022-09-21 10:35:00浏览次数:73  
标签:type ThinkPHP5 request error variable post data array

这种形式的数据同过POST提交数据在TP5框架内通过$request->post(‘参数’);去接收就会报错。

variable type error:array 这是因为tp5不能用post去接收数组‘data’:[1,2,3,4,5]这种数据。

在通过request的post方法取获取时,post方法不能分辨它是否是数组。

所以在想不改变post提交方式的情况下,解决办法之一就是用/a。(这里的/a就相当于告诉解析器我要获取一个数组。)

$data = $this->request->post("data/a");

  

标签:type,ThinkPHP5,request,error,variable,post,data,array
From: https://www.cnblogs.com/lusanqian/p/16714709.html

相关文章