How to realize PHP Database and Interface Design
This article focuses on "how to achieve PHP database and interface design", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to achieve PHP database and interface design"!
Description:
1. The MVC architecture is not entirely adopted, but that's the idea. Because it is not possible to write a stable MVC architecture.
two。 Hardly use JQUERY AJAX because it is not very familiar with it, and it is not easy to use it. You can use AJAX to leave a message, no problem.
3. There are several common classes, other code are handwritten, there are deficiencies, please point out, thank you very much.
4. Criticism and guidance are welcome, but please give your reasons.
Back to the point: look at the database architecture first.
The engine of these tables is MYISAM, which is easy to access. (the yellow key indicates that the primary key; blue diamond represents a non-empty field; the white diamond represents the null field.) the links in the figure only indicate that there is a potential relationship between them and cannot be associated during operation. Because the search engine is MyISAM. So federated queries and multi-table operations are required.
I will pick the most important post, category two special fields in the table to explain in detail, the other said important.
Post:
Post_id
Category_id varchar (10) this is used to index the classification of blog posts, where the category_id is also a string type, so you can set multiple categories for each blog post.
Type varchar (20) this field is used to distinguish between essays (post), articles (article), and diaries (diary); it can also be set to postDraft, articleDraft
Whether the visiable blog post is visible
Other common fields such as title, content, creation time, last change time, number of views, number of comments, tags, allowed comments, and some reserved fields.
Category:
Parent, count_child_number, count_parent_number are used for future expansion
Type can set up the classification of photo albums, blog posts and diaries respectively.
Other common fields such as name, description, creation time, visibility
Comment:
Address user IP
User_agent user browser type
Other fields are slightly.
Server architecture
PHP5.4.2 + MYSQL 5.523 + APACHE 2.2.22 + Windows NT ARIST-PC 6.1build 7600 (Windows 7 Home Basic Edition) i586 (local)
Blog architecture
Background directory:
Background directory description:
Assert stores all kinds of resources js,css,image
Class stores our common classes such as database operations, paging, and most of our model.
Extention stores rich editors with extensions such as mce
Config stores our configuration information
Templates stores all templates (without smarty)
Upload stores photos and other documents
There will be some similar controllers under the admin root directory, such as index.php, post.php, article.php, photo.php
Let's take a look at admin/config/config.php.
The copy code is as follows: