0

我在我的网站上得到了这个: 注意:未定义的偏移量:1 in ...

这是完整的代码,粗体部分是我认为它所指的部分,基本上这个脚本应该从数据库中获取我的频道列表,然后显示来自抽搐的信息:

<?php

defined('_JEXEC') or die('Direct access to this location is not allowed.');
$userList = $params->get('userlist');
$usersArray = explode(',', $userList);
$userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
$checkedOnline = array ();
foreach($usersArray as $i =>$value){
    $userGrab .= ",";
    $userGrab .= $value;
}
unset($value); 
$json_file = file_get_contents($userGrab, 0, null, null);
$json_array = json_decode($json_file, true);
//used to be $viewer = $json_array[$i]['stream_count'];

**foreach($usersArray as $i =>$value){
    $title = $json_array[$i]['channel']['channel_url'];
    $array = explode('/', $title);
    $member = end($array);
    $name = $json_array[$i]['name'];
    $game = $json_array[$i]['meta_game'];
    $viewer = $json_array[$i]['channel_count'];
    $topic = $json_array[$i]['title'];
    onlinecheck($member, $viewer, $topic, $game);
    $checkedOnline[] = signin($member);
}**

unset($value);
unset($i);

function onlinecheck($online, $viewers, $topic, $game)
{  
    if ($game == "Counter-Strike: Global Offensive")
        {
            $igra = "csgo12.jpg";
        }
    else{
            $igra = "online.png";
        }   
    if ($online != null)
        {

                    echo '&nbsp;<img src="./modules/mod_twitchlist/tmpl/'.$igra.'">';
                    echo '<a href="http://www.twitch.tv/'.$online.'" target="_blank"> <strong>'.$online.'</strong></a>';
                    echo '&nbsp;(' .$viewers.') - ';
                    echo '<strong>'.$topic.'</strong> </br>';

        }
}

function signin($person){
if($person != null){
    return $person;
}
else{
    return null;
}
}
?>
<!-- <hr> -->
 <?php
foreach ($usersArray as $i => $value1) {
    foreach($checkedOnline as $ii => $value2){
        if($value1 == $value2){
            unset($usersArray[$i]);
        }
    }

}


$broj1 = count($usersArray); //neaktivni korisnici
$broj2 = count($checkedOnline); //ukupno streamova

if ($broj1 == $broj2){
echo '<strong><center>Nijedan stream nije aktivan trenutno!</center></strong>';
}
 ?>

有什么提示吗?

4

0 回答 0