2017-12-15 20 views
0

나는 특정 디렉토리에서 모든 하위 폴더를 가져 와서 php로 html 출력의 하위 폴더를 표시하는 기능을 가지고 있습니다. 지금까지는 작동하지만 지금은 위의 폴더에서 두 개의 항목이 있습니다. 로 재연했다. 두 번째 항목은 .. 어떻게 내 스크립트를 수정해야합니까?하위 폴더에서 처음 두 항목을 제거합니다 PHP 스크립트

<?php 
$dir = "pictures/whatsapp/"; 

// Open a known directory, and proceed to read its contents 
if (is_dir($dir)) { 
    if ($dh = opendir($dir)) { 
     while (($file = readdir($dh)) !== false) { 

// Where to filter or delete the two entrys from folder . and .. ??? 

      echo '<a href="whatsapp/'.$file.'/" title="Whatsapp DP '.ucwords(str_replace("-"," ", $file)).' Images"><i class="ion-social-whatsapp-outline"></i>'.ucwords(str_replace("-"," ", $file)).'<i class="ion-record"></i></a>'; 
     } 
     closedir($dh); 
    } 
} 
?> 

답변

0

om을 건너 뛰려면 다음 줄에 루프를 추가하기 만하면됩니다. 그리고 ..

+0

내 친구가 미안해하므로 내 자신을 검색하고 적절한 솔루션을 찾았습니다. 감사합니다. 감사합니다. 감사합니다. –