开发者

What Does the Code For a PHP Site Typically Look Like? [closed]

开发者 https://www.devze.com 2023-04-11 12:15 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

A friend and I have been working on a moderate-sized PHP website for some time now. Although we have both worked on and finished multi开发者_如何学Gople small websites (in terms of amount of code), this is our first website that has required a very large amount of code.

We have come up with our own site structure. So far, it has seemed to be working pretty well for us. However, we'd like to see some examples of what might be considered "good" PHP coding for a dynamic website.

So, are there any possibly open-source examples of well coded PHP websites that we could take a look at? I think going over a bunch of code will help us come up with better ways to organize the code for our site.


Well, I use the Symfony2 MVC framework now so, although you can use your own directory structure, I like to stick up with the one that comes with the Standard edition.

However, at the times of PHP4 (that good ol' times :D) I used almost always this structure:

  • includes/ - my libraries
  • templates/ - views, CSS files, images, etc.
  • languages/ - application tanslations
  • modules/ - basically, modules were sets of controllers in my applications
  • web/ - public content (usually just a front controller)

I've always found myself pretty comfortable with this structure.


Here is a simple login system with admin features. It's a bit older but has a fair code structure that is easy to navigate. You may be able to learn quite a bit from it. This is where I learned PHP.

jpmaster77's Login System


My vote for a well-structured PHP project is the Mantis Bug Tracker. I learned a lot about PHP from tweaking and maintaining a Mantis installation. This was actually my introduction to PHP.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号