file_existsThe goal is to check if the file exists. He returns a lie. This means your file does not exist where php is looking for. php may look in a different area than you expect. It seems like time for some debugging.
Run this to find out where php is located.
echo "current working directory is -> ". getcwd();
This is where do you want php to look? If not, then change the directory where php is looking for using the function chdir.
$searchdirectory = "c:\path\to\your\directory"; //use unix style paths if necessary
chdir($searchdirectory);
( : , Windows.)
class A {
...
//change working directory
$searchdirectory = "c:\path\to\your\directory"; //use unix style paths if necessary
chdir($searchdirectory);
foreach ($blocks as $block) {
$block = 'dir\dir2\' . $block;
if (file_exists($block) == true) {
$var .= file_get_contents($block);
}
}
}