不知道如何解決這個錯誤注意:未定義偏移:使用0陣列中
注意:未定義偏移量:0在C:\ XAMPP \ htdocs中\ streams.php上線50 說明:未定義偏移:0在C:\ XAMPP \ htdocs中\ streams.php上線53 注意:未定義偏移量:0在C:\ XAMPP \ htdocs中\ streams.php線路54上
代碼其指:
<?php
$members = array("hawkmyg");
$userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
$checkedOnline = array();
foreach($members as $i =>$value){
$userGrab .= ",";
$userGrab .= $value;
}
unset($value);
//grabs the channel data from twitch.tv streams
$json_file = file_get_contents($userGrab, 0, null, null);
$json_array = json_decode($json_file, true);
//get's member names from stream url's and checks for online members
foreach($members as $i =>$value){
$title = $json_array[$i]['channel']['channel_url'];
$array = explode('/', $title);
$member = end($array);
$viewer = $json_array[$i] ['stream_count'];
onlinecheck($member, $viewer);
$checkedOnline[] = signin($member);
}
無法確定如何修復
沒有看到您的輸入數據('$ members'和'$ json_array'),沒有人可以幫助您。但是我希望在第一次循環期間'$ i == 0'和'$ json_array'沒有'0'元素。 – ThiefMaster
使用標準的調試工具'var_dump'或'print_r' –
uset print_r來查看偏移量0是否真的存在 –