i have this code and i am create a list with url images, for each image in the list i need a random image, when i launch the program, usually have this error undefined offset in line 340, how do to fixed this error
$lista = array();
foreach ($imagenes as $img) {
// var_dump($img['url']);
array_push($lista, $img['url']);
}
$p = array_rand($lista);
//echo $p;
if ($p != NULL || $p > 0) {
echo '"Img": "' . $lista[$p]. '"' .",\n";
} else {
echo '"Img": "'."Sin imagen" . '"' .",\n";
}
Aucun commentaire:
Enregistrer un commentaire