PHP框架类-如何通过class启动类

发布于 2024-10-20 17:17:33 字数 353 浏览 7 评论 0原文

我通常在一个名为 baseFrame 的网站上设置一个初始类,它包含所有基本功能。 (MVC 风格)

现在,我意识到我在从整个网站调用的类调用 baseFrame 时遇到了问题(baseFrame 有一个名为 callClass 的函数,我用它来包含并运行从基础扩展的新类。我意识到你不能在函数下调用扩展类,因为它无法读取父类,

所以,我编写了一个名为“callfunction.php”的新脚本,它本身不是一个类基,它是一个直接调用的函数。扩展类,它正确地调用了baseFrame。但是我不习惯不使用类。我是否愿意从baseFrame类中调用一个新类?同样,在 baseFrame 类中运行一个类根本不允许我调用扩展......所以我猜这在技术上是不可能的?

I usually setup a initial class on a website called something like baseFrame, which holds all the basics functions. (MVC style)

Now, I realized I was having issues calling the baseFrame from classes called throughout the website (the baseFrame has a function called callClass, which I was using to include and running the new class that extends from the base. I realized that you can't call a extended class under a function, because it's unable to read the parent class.

So, I wrote a new script called "callfunction.php" which was not a class base it self, it was a straight function that called the extended class, which calls the baseFrame correctly. Now this method worked, I however am not used to not using classes. Is there something I'm missing? Would I rather call a new class from within the baseFrame class? Is that possible? Again, running a class within the baseFrame class didn't allow me to call the extended at all...So I'm guessing that isn't technically possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾其所爱 2024-10-27 17:17:33

可能这个资源有帮助。
有许多框架可以构建安全可靠的系统。

注意:mvc 只是一种解决方案。

http://framework.zend.com/

http://wordpress.com (可通过插件扩展)

http://www .codeigniter.com/

may be this resources help.
there are many frameworks to build secure and reliable systems.

note: mvc is just one solution.

http://framework.zend.com/

http://wordpress.com (extensible via plugins)

http://www.codeigniter.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文