PHP框架类-如何通过class启动类
我通常在一个名为 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能这个资源有帮助。
有许多框架可以构建安全可靠的系统。
注意: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/