문제

$count = 0;

if ($handle = opendir('./arkiv/')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            $count++;
            print("<a href=\"arkiv/".$file."\">".basename($file, ".php")."</a><br />\n");
        }
    }
    echo '<br /><br /><a href=".">Tilbake</a>';
    closedir($handle);
}

This is the code I'm using, and I'm trying to figure out where to but 'rsort', but this is very new to me, can anyone help me?

도움이 되었습니까?

해결책

Possible use can be like

$count = 0;
         $fileArray = array();
         if ($handle = opendir('./arkiv/')) 
         {
            while (false !== ($file = readdir($handle))) 
            {
               if ($file != "." && $file != "..") 
               {  
                  $count++;
                  $fileArray[] = $file; 

               }
            }
            rsort($fileArray);
            foreach($fileArray as $file)
            {
               print("<a href=\"arkiv/".$file."\">".basename($file, ".php")."</a><br />\n");
            }

            echo '<br /><br /><a href=".">Tilbake</a>';
            closedir($handle);
         }

Give it a try .... GOOD LUCK !!!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top