I'm working on a sitemap script but now I need to know how I can scan all my photo's since they are in different folders (I'm working with albums) All my images that I want to get into the sitemap are in this directory: public_html/Albums/{Albumname}/{photo name}

How can I do this?

有帮助吗?

解决方案

If the location in not remote then you can try the following:

<?php
$path = realpath('public_html/Albums');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
{
        echo "$filename\n";
}
?>

You can generate the URL accordingly in the loop.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top