Trying to get property of non-object
그 속성이 존재하지 않기 때문에 ->property
호출 중 하나가 실패 의미합니다. 이 경우 실패한 $ o- 결과입니다.
print_r($array);
출력 : 당신이 내부 객체를 얻기 위해이 구조를 따를 수
이제
stdClass Object
(
[success] => 1
[message] =>
[result] => Array
(
[0] => stdClass Object
(
[Id] => 10044
[TimeStamp] => 2014-06-12T04:36:32.227
[Quantity] => 3
[Price] => 2.9E-5
[Total] => 8.7E-5
[FillType] => FILL
[OrderType] => BUY
)
[1] => stdClass Object
(
[Id] => 10040
[TimeStamp] => 2014-06-12T04:23:22.683
[Quantity] => 49.9
[Price] => 2.5E-5
[Total] => 0.0012475
[FillType] => PARTIAL_FILL
[OrderType] => SELL
)
...
:
은 $ 배열의 내용을 인쇄하는 경우, 당신은이 같은 구조있어 볼 수 있습니다
<?php
$json_string = file_get_contents("https://bittrex.com/api/v1/public/getmarkethistory?market=BTC-HYPER&count=5");
echo "<table>\n";
$array = json_decode($json_string);
foreach ($array->result as $o) {
echo "<tr><td>$o->TimeStamp</td></tr>\n";
}
echo "</table>\n";
출력 :
<table>
<tr><td>2014-06-12T04:36:32.227</td></tr>
<tr><td>2014-06-12T04:23:22.683</td></tr>
<tr><td>2014-06-12T04:01:43.217</td></tr>
<tr><td>2014-06-12T02:02:29.03</td></tr>
...
'foreach ($ array-> result as $ o)'와'$ o-> TimeStamp'? 그리고 당신은 또한'echo'를 사용해야합니다 – asprin
당신이 이것을 위해 Jquery를 사용하고 싶다면 다음 링크들이 있습니다 : http://www.zachhunter.com/2010/04/json-objects-to-html-table/, 2 - http://stackoverflow.com/questions/1051061/convert-json-array-to-an-html-table-in-jquery –