我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Zendesk - 为foreach()提供的参数无效

I'm using the recent tickets JSON feed in Zendesk with the following line of PHP:

$data = curlWrap("/tickets/recent.json", null, "GET");

When I use a foreach function as below, I get the error message "Invalid argument supplied for foreach()".

foreach ( $data->tickets as $ticket )

What am I doing wrong?

It needs to be an array. You can use the json_decode() to turn it into an array, eg

$json = curlWrap("/tickets/recent.json", null, "GET");
$data = json_decode($data);

And then you can proceed with the foreach array.

近期文章

  • 在自定义菜单wordpress中添加样式图像
  • 如何用数据库中的(大量)记录填充HTML表单?
  • MySQL Query - 如何根据范围值选择行
  • Yii Framework权限访问菜单
  • 提交后ajax登录csrf键输入更改
  • 如何在MySQL中使用两个标记参数过滤结果?
  • 如何将用户收件人地址发送到浏览器链接?
  • 如何获取我的应用程序的访问令牌,以便我可以作为页面在页面上发布?
  • php查询mysql文本
  • Facebook - 在视频应用程序中获取和显示我/ og.likes
  • 加入时表的mySQL大小
  • 如何将SCSS集成到我的代码中[重复]
  • mySQL另一个组合查询
  • 如何在页面上记录访问持续时间?
  • 带有标签的php简单搜索框
  • 无法发送邮件PHP recaptcha
  • 在foreach中递归地取消设置变量
  • 正则表达式字符后跟数字php
  • Ajax请求不使用dataType“jsonp”或“json”
  • wordpress将自定义列添加到自定义帖子类型

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华