Search code examples
phprequire-once

Can you run require_once recursively in php?


Is it possible to run require_once recursively in one line like this:

<?php
require_once('./OAuth2/*');

Or would you have to go to each file directly and require it?


Solution

  • cant do it that way. something like this would work:

    foreach (glob("./OAuth2/*.php") as $filename)
    {
        require_once($filename);
    }