【发布时间】:2014-07-13 17:47:55
【问题描述】:
我正在尝试从 JSON 页面获取数据: http://www.oref.org.il/WarningMessages/alerts.json
我遇到了错误。
如何从 JSON 中获取“数据”数组?
这是我正在做的一个例子:
$homepage = file_get_contents('http://www.oref.org.il/WarningMessages/alerts.json');
$result = json_decode($result);
$result = utf8_encode($result);
print_r($result);
【问题讨论】:
-
utf8_encode()的参数应该是一个字符串。json_encode()返回一个对象。 -
那么我需要做什么?你能给我举个例子吗?
-
摆脱
utf8_encode。无论如何都没有理由在这里使用它。 -
我在希伯来语上使用 utf8_encode bcz 标题,当更新时数组将是希伯来语
-
你说你只想要数据数组,那么为什么标题很重要?