Require all files in a folder

后端 未结 9 1417
南旧
南旧 2020-12-28 13:13

Is there an easy way to programmatically require all files in a folder?

9条回答
  •  长发绾君心
    2020-12-28 13:18

    Use a foreach Loop.

    foreach (glob("classes/*") as $filename) {
      require $filename;
    }
    

    For more details, check out this previously posted question:

提交回复
热议问题