Invalid argument supplied for foreach() - using glob

前端 未结 3 1181
深忆病人
深忆病人 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:09

    Change this:

    $path[] = $dir;
    foreach($path as $dirname){
        $add = glob($dirname . '/*.css');
        foreach($add as $file){
    

    to this:

    $path[] = $dir;
    var_dump($path);
    foreach($path as $dirname){
        $add = glob($dirname . '/*.css');
        var_dump($add);
        foreach($add as $file){
    

    We don't know which line 131 is, so I don't know which foreach fails.

    (I'm guessing the 2nd, because the first is practically forced to array by $path[] = ..)

提交回复
热议问题