开发者

PHP directory list question?

开发者 https://www.devze.com 2022-12-28 01:44 出处:网络
Can someone help me with this,I\'m stuck.Dont know why this dont work $myPath = get_bloginfo(\'wpurl\').\'/wp-content/uploads/\'; // this is full path

Can someone help me with this,I'm stuck.Dont know why this dont work

$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.'</op开发者_如何学JAVAtion>';
        //}
    }
    closedir($dir);
    echo $fs;
}

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


According to the function reference, get_bloginfo('wpurl') is going to be returning a URL. If you want to access the local file system, you need a real filepath, not a URL.

Try this for the first line:

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

WP_CONTENT_DIR is defined in the config file, and should point to the wp-content folder of your installation.

0

精彩评论

暂无评论...
验证码 换一张
取 消