postman post请求 thinkphp 返回错误 variable type error:array
2022-11-24 11:10:29
179
{{single.collect_count}}

  在使用postman整理别人的接口的时候,发现使用postman使用get请求获取的是一个网页,但是使用post请求的时候返回

发现在源码中,php代码返回是array

但是postman需求的返回并不是array,这个时候就会报错。现在能找到的就是修改thinkphp中config.php文件下

修改这个html为json,返回json格式数据,就可以把php代码中的返回array变为json返回。但是会影响原来页面(需求array)的解析,导致浏览原来页面的时候回报错。

但对于归类代码文档来说,足够了,应为请求是上去了,只是返回显示的是variable type error而已。

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}