Quantcast
Channel: php file_get_contents loop all files in same directory - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Viktor for php file_get_contents loop all files in same directory

foreach (glob("*.html") as $file) {$page = file_get_contents($file);$current = preg_replace('<!--[^\[](.*?)-->', '', $page);file_put_contents($file, $current);echo $file . "<br>";}This...

View Article



Answer by FMK for php file_get_contents loop all files in same directory

I wrote a function similar to your needs not long ago:private function getFilesByPattern($pattern = '*.html', $flags = 0){ $files = glob($pattern, $flags); foreach (glob(dirname($pattern) . '/*',...

View Article

php file_get_contents loop all files in same directory

I'm working on a simple comments removal script in PHP. What I'd like to do is loop this entire script for all the files in the same directory. At this point I'm not concerned with subdirectories or...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images