问题描述:

This question already has an answer here:

  • undefined offset PHP error

    4 answers

网友答案:

The error "Undefined Offset" means you are trying to access an index of an array that does not exist.

My best guess is that the offending code is:

if($sites2[$i] == $s_id){
    echo "checked";
}

And an Undefined offset of 3 is telling you that $sites2[3] does not exist. Instead, you could try something like:

if(isset($sites2[$i]) && $sites2[$i] == $s_id){
    echo "checked";
}
相关阅读:
Top