我有一个csv文件我只使用文件中的一些列,现在我想通过点击每列的标题来排序HTML表,我希望能够对加入和降序信息进行排序use是数组的形式
<?php
$datei = fopen("soom.txt","r");
$count = fgets($datei,1000);
fclose($datei);
$count = $count ;
// opens countlog.txt to change new hit number
$datei = fopen("soom.txt","w");
fwrite($datei, $count);
fclose($datei);
$favcolor = $count;
echo "<font color = 'green' size='5' face='Comic Sans MS'>";
switch ($favcolor) {
case 1:
echo "27 May 2017 - Volkskool Potchefstroom";
break;
case 2:
echo "17 June 2017 - President Klerksdorp";
break;
case 3:
echo "29 July 2017 - Trails Stilfontein";
break;
case 4:
echo "12 August 2017 - Schoonspruit Saamtrek";
break;
case 5:
echo "26 August 2017 - Meiringspark Klerksdorp";
break;
case 6:
echo "9 September 2017 - Rustenburg";
break;
case 7:
echo "14/21 October 2016 - Matlosana Mall";
break;
case 8:
echo "4 November 2017 - Stratvaal Klerksdorp";
break;
case 9:
echo "25 November 2017 - Baillie Park Klerksdorp";
break;
default:
echo "";
}
echo "<font color = 'white' size='3' face='Arial'>";
echo nl2br (" \n ");
$fp = fopen ( "tour.$count.csv" , "r" );
while (( $data = fgetcsv ( $fp , 1000 , "," )) !== FALSE ) {
"<tr>";
echo "<td>".$data[0]."</td>";
echo "<td>".$data[10]."</td>";
echo "<td>".$data[2]."</td>";
echo "<td>".$data[3]."</td>";
echo "<td>".$data[4]."</td>";
echo "<td>".$data[7]."</td>";
echo "/<tr>";
}
fclose ( $fp );
?>