Jump to content

Self nested function returns cgi error


sachavdk

Recommended Posts

Hi,

I'm trying to write a function that loops through a folder I specify,
if a specific file is also a folder, the function itself is called again with the new directory path,
it loops through this one, ...

But the error I get is:
[b]The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:[/b]
(No headers are sent with it).
Here's the function (var $tpls is not used yet but I don't think that'll be the problem):
[b]$tpls = "";
$dir = "styles/main/tpl/";
function loopDirs($dir, $tpls) {
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (is_dir($dir . "/" . $file . "/")) {
loopDirs($dir . "/" . $file . "/", $tpls);
}
else {
echo $dir . "/" . $file."<br />";
}
}
closedir($dh);
}
}
}
loopDirs($dir, $tpls);[/b]
Link to comment
https://forums.phpfreaks.com/topic/34933-self-nested-function-returns-cgi-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.