doujiyan0031 2009-12-07 13:36
浏览 54
已采纳

无法在Ubuntu中迭代对象PHP 5.2.10-2适用于PHP 5.2.10吗?

With this code I am iterating through an object.

Works:

  • Windows with WAMP and PHP 5.2.9
  • Linux web server with PHP 5.2.10

It is not working on my desktop:

  • Ubuntu 9.10 with PHP 5.2.10-2 from the repo's
$incomingData = json_decode($_POST['data']);

foreach($incomingData as $key => $action)
{

}

Invalid argument supplied for foreach()

  • 写回答

3条回答 默认 最新

  • dongyang5716 2009-12-07 13:59
    关注

    Maybe one of your servers has magic_quotes_gpc enabled, so you can try to use stripslashes on $_POST['data'] before you decode it. Both PHP versions should be able to iterate through objects.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥15 在现有系统基础上增加功能