您可以尝试这样的操作,从内存写入,因此可能需要调试。。。
//this assumes you always start at 1 and increment by 1
$countBMW = 1;
if(file_exists('[~/yourpath/]BMW_'.$countBMW){ //check if any exist
while(file_exists('[~/yourpath/]BMW_'.$countBMW)){
$countBMW++; //increase count each time a file exists
}
}
while($countBMW > 0){ //while some images haven't been iterated over...
echo '<img src="[~/yourpath/]BMW_'.$countBMW.'" [other attributes you need]>'; //print them out
$countBMW--; //decrease by 1
}
对每个模型重复上述步骤,您可以将模型存储在一个数组中,并循环使用该数组,用数组值替换硬编码的“BMW”文本。你需要有一个
variable variable
也