【发布时间】:2016-04-10 22:48:19
【问题描述】:
我正在使用 Slim 框架开发网络应用程序。 但是,我遇到了一些我无法解决的问题。
我想在类中组织我的代码并从类中调用某些方法。 我有一个 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 Generate_num
{
public static function generate()
{
//some code
}
}
有什么建议吗?谢谢!
【问题讨论】:
-
只是一个友好的提示,您可能需要阅读此页面:The How-To-Ask Guide,这样您就可以始终确保您的问题易于回答且尽可能清晰。请务必包括您为解决遇到的问题所做的任何努力,以及尝试这些修复时发生的情况。也不要忘记您的显示代码和任何错误消息!