I have a local XAMP install on my Mac. I have this code:
foreach (new DirectoryIterator('test') as $fileInfo) {
if ($fileInfo->isDot() && $fileInfo->getBasename() !== '.DS_Store') {
continue;
}
$xmlFile = "test/" . $fileInfo->getFilename() . "/content.xml";
if (file_exists($xmlFile)) {
$xml = simplexml_load_file($xmlFile);
foreach ($xml->infos as $infos) {
echo "<li><a href='#tab_3' data-toggle='tab'>$infos->bezeichnung</a></li>";
}
}
}
The problem is that I get an error that says that the file .DS_Store
cannot be opened. I thought my code filtered out the .DS_Store
directory. It's clear that this file cannot be opened. It is a mac specific folder.