PHP dizin listesi soru?

1 Cevap php

Birisi bana bu konuda yardımcı olabilir, ben bu işi neden dont stuck.Dont biliyor değilim

$myPath = get_bloginfo('wpurl').'/wp-content/uploads/'; // this is full path

function ReadDirList($d){
    $dir = opendir($d);
    $fs = "";
    while($folder = readdir($dir))
    {
        //if(is_dir($folder)){
            $fs = $fs. '<option>'.$folder.'</option>';
        //}
    }
    closedir($dir);
    echo $fs;
}

I call this function <select> <?php ReadDirList($myPath); ?> </select> tnx in advance.

1 Cevap

Fonksiyon referansa göre, get_bloginfo('wpurl') bir URL iade olacak. Eğer yerel dosya sistemine erişmek istiyorsanız, gerçek bir dosya yolu değil, bir URL gerekir.

Ilk satır için bu deneyin:

$myPath = WP_CONTENT_DIR.'/uploads/'; // this is full path

WP_CONTENT_DIR config dosyasında tanımlanır, ve kurulum wp-content klasöre işaret etmelidir.