What is the right way to make a PHP website object oriented and MVC?
I was wondering what is the right way to use PHP in an Object oriented way and with a goo MVC architectural pattern?
I tried for a project at school to use MVC and make it Object orient开发者_如何学Ced, but I am sure I wend the wrong way, because when it came to deploying the website I had so many issues it was not usable. Obviously now I am trying to figure out how, if I started all over would I go around doing it?
Would it make such a big difference using a framework like Zend? If anyone could point me to a good structured open source example I would be very happy, because I just can't figure out the "proper" way to do it.
Edit My main problem is not understanding MVC or OO separately, but using them together with PHP.
I'll suggest the following:
- Understand the underpinnings of an MVC by skimming thru The no-framework PHP MVC framework (don't mind the code).
- Test MVC with a big name framework like Symfony to see "best practices" at play. Their documentation and code is worth spending time on.
- Experiment.
You should use some already created and tested framework. (They really spare time and code-writing) This is a good website for different PHP frameworks comparison.
In my opinion, if you want something small and light, you can check CodeIgniter or Yii framework
精彩评论