Invalid argument supplied for foreach() - using glob

前端 未结 3 1161
深忆病人
深忆病人 2021-01-23 16:42

Today i have a problem with my script, my script should search for (.css files)

I\'ve used a code to:

  1. Search for all subfolders in a root folder
3条回答
  •  佛祖请我去吃肉
    2021-01-23 17:20

    I found the same issue with a PHP script today and it took switching from a foreach loop to a for loop to fix it. Not sure what means, the array looks and works the same.

    // Errors out
    $files = glob($directory.'*.html');
    foreach($files as $file){
        echo($file);
    }
    
    // No error
    $files = glob($directory.'*.html');
    for($i=0; $i

提交回复
热议问题