Require all files in a folder

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

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

9条回答
  •  醉酒成梦
    2020-12-28 13:24

    As require_all() function:

    //require all php files from a folder
    function require_all ($path) {
    
        foreach (glob($path.'*.php') as $filename) require_once $filename;
    
    }
    

提交回复
热议问题