문제

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