Read images from a directory using PHP

后端 未结 6 529
广开言路
广开言路 2020-12-19 16:35

I am wanting to find out if the following is possible with PHP inside WordPress.

Basically if I have a directory in my site called \"promos\" that consists of 1 to

6条回答
  •  一整个雨季
    2020-12-19 16:58

    This code will provides the images from the directory called "imagfolder"

    if($handle = opendir(dirname(realpath(__FILE__)).'/imagefolder/')){
                    while($file = readdir($handle)){
                        if($file !== '.' && $file !== '..')
                        {
                            echo '
    '; echo ''; echo '
    '; } } closedir($handle); }

提交回复
热议问题