Solution de l'exercice :

Source : lesson_12_e_read_dir.php Résultat
<?php
$DirPath
="../".$_GET['DirPath'];
if(
$DirPath=="")
{
   
$DirPath='./';
}
if ((
$handle=opendir($DirPath)))
{
   while (
$node readdir($handle))
   {
       
$nodebase basename($node);
       if (
$nodebase!="." && $nodebase!="..")
       {
           if(
is_dir($DirPath.$node))
           {
               
$array_dir[]= "<font color=blue><b>".
                   
$DirPath.$node."</b></font><br/>";
           }
           else
           {
               
$array_dir[]= $DirPath.$node."<br/>";
           }
       }
   }
}
asort($array_dir);
foreach (
$array_dir as $v2)
    {
        print 
"$v2\n";
    }
?>


../.ovhconfig
../index.html
../licence.html
../phpinfo.php
../smartphone.php
../admin
../applications
../ateliers
../classes
../colors
../commons
../docweb
../environment
../exercises
../fonctions
../forum
../forum_futur
../images
../images_liens
../intro
../lesson_01_environnement
../lesson_02_variables
../lesson_03_operators
../lesson_04_control_structures
../lesson_05_arrays
../lesson_06_functions
../lesson_07_forms
../lesson_08_classes
../lesson_09_mysql_1
../lesson_10_dates
../lesson_11_error_handling
../lesson_12_i_o_functions
../lesson_13_authentication
../lesson_14_persistence
../lesson_15_mysql_2
../lesson_16_string_manipulation
../lesson_17_images
../lesson_18_i_o_to_navigator
../lesson_19_environment
../lesson_20_mailing
../mysql_connexion
../mysql_connexion_
../questions
../quiz
../quiz_questions
../quiz_teacher
../solutions
../stat_user
../statistiques
../style_sheets
../webpasse


Tous droits réservés. 2005-2020