Php 未定义的偏移量:行中的4
请参阅给定的多文件上载脚本,错误为未定义的偏移量:行中的4Php 未定义的偏移量:行中的4,php,Php,请参阅给定的多文件上载脚本,错误为未定义的偏移量:行中的4 for($i=0; $i<=count($_FILES['pics']); $i++) { $tmpFilePath = $_FILES['pics']['tmp_name'][$i]; // this row error $extract=explode(".",$_FILES["pics"]["name"][$i]); $exten=$extract[1]; $completes=str_shu
for($i=0; $i<=count($_FILES['pics']); $i++) {
$tmpFilePath = $_FILES['pics']['tmp_name'][$i]; // this row error
$extract=explode(".",$_FILES["pics"]["name"][$i]);
$exten=$extract[1];
$completes=str_shuffle(str_replace(" ","",$_POST["title"].$extract[0])).".".$exten;
$images[]=$completes;
$newFilePath = "data/product/" . $completes;
move_uploaded_file($tmpFilePath, $newFilePath);
$data = getimagesize($newFilePath);
$width=$data[0];
$height = $data[1];
$newWidth= $width/$height*342;
$image = new SimpleImage();
$image->load($newFilePath);
$image->resize($newWidth,342);
$image->save("data/product/".$completes);
}
$images=implode(",",$images);
for($i=0;$iload($newFilePath);
$image->resize($newWidth,342);
$image->save(“数据/产品/”$完成);
}
$images=内爆(“,”,$images);
更改以下行:
for($i=0; $i<=count($_FILES['pics']); $i++)
for($i=0;$iUse现在它发出通知:Undefined offset:3 inI没有读取其余的代码。您的问题是,您误解了$\u文件的结构。
数组。请使用var\u dump()
查看它的结构。我想您会发现错误的。
for($i=0; $i<count($_FILES['pics']); $i++) // <= is replaced by <