autoload functions in php

后端 未结 5 822
难免孤独
难免孤独 2020-12-07 03:35

Is it possible to autoload functions?

What I have is I have written functions distributed over different files named after the function name, so what I need is to au

5条回答
  •  既然无缘
    2020-12-07 03:42

    You can autoload classes, so if you make your functions static methods of classes then it will work.

    abstract class Util
    {
        static function doSomething() {
    
        }
    }
    

    Usage:

    Util::doSomething();
    

提交回复
热议问题