更新时间:2023-12-02 21:30:46
希望这是您想要的:
$.each([
'civic.html',
'durango.html',
'mustang.html',
'r8.html'
], function(i,a){
$("#all_cars").load("../cars/" + a);
});
$.each
将遍历数组.
carindex.php
的文件,并将其内容设置为:
carindex.php
, set it's content to:
<?php
print json_encode(scandir('PATH/TO/cars/', 1));
?>
然后在客户端:
$.get('/carindex.php', function (a) {
a.forEach(function (b) {
$("#all_cars").load("../cars/" + b);
});
});