从 .class.php 文件调用方法(超薄框架)

Calling a method form a .class.php file (slim framework)

我正在使用 Slim 框架开发网络应用程序。 但是,我遇到了一些我无法解决的问题。

我想在 classes 中组织我的代码并从 classes 中调用某些方法。 我有一个 index.php 文件,其中存在以下函数:

$app->post('/',  function () use ($app) {
// some code here
//a variable  $result I want to get the result from a method of the    class Generate_num
$result = (here I want it to take as a result the function "generate"     from a .class.php file which I have stored in a special folder "classes"
 //another code
});

我的 class 代码看起来像这样

class Generate_num
{
public static function generate()
 {
//some code
 }
}

有什么建议吗?谢谢!

鉴于此 class:

class Generate_num
{
    public static function generate()
    {
        //some code that creates $number
        return $number;
    }
}

你这样称呼它:

$number = Generate_num::generate();