我有这个作为结果和从脚本创建的 HTML 页面。
thumbnail[++nr] = new makeIt(nr, "slides/IMG_3924.html", "thumbs/IMG_3924.jpg", 150, 100, "IMG_3924.jpg", "slides/IMG_3924.jpg", 150, 100, "", "sorting01", 0)
thumbnail[++nr] = new makeIt(nr, "slides/IMG_3909.html", "thumbs/IMG_3909.jpg", 100, 150, "IMG_3909.jpg", "slides/IMG_3909.jpg", 100, 150, "", "sorting02", 0)
thumbnail[++nr] = new makeIt(nr, "slides/IMG_3914.html", "thumbs/IMG_3914.jpg", 150, 100, "IMG_3914.jpg", "slides/IMG_3914.jpg", 150, 100, "", "sorting02", 0)
thumbnail[++nr] = new makeIt(nr, "slides/IMG_3904.html", "thumbs/IMG_3904.jpg", 100, 150, "IMG_3904.jpg", "slides/IMG_3904.jpg", 100, 150, "", "sorting01", 0)
这是产生它的代码
if ($file2 != "." && $file2 != ".." && strpos($file2,'.')!==0 ) {
list($widthT2, $heightT2, $type2, $attr2) = getimagesize($pathToThumbs."/$name2.jpg");
$thumbW2 = $widthT2;
$thumbH2 = $heightT2;
$out[]="thumbnail[++nr] = new makeIt(nr, \"slides/$name2.html\", \"thumbs/$name2.jpg\", $thumbW2, $thumbH2, \"$name2.jpg\", \"slides/$name2.jpg\", $widthT2, $heightT2, \"\", \"$commentaire\", 0)\n";
}
}
//usort($out, function ($a, $b){
// return substr($b, -8) - substr($a, -8);
//});
sort($out);
foreach($out as $key => $value){
print $value;
}
如何对结果进行排序,以便它们按 排序sorting01
,然后sorting02
按每行末尾的文本排序?我想从每行的最后两个字段包含的内容中对数组进行排序。