Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Professor Ma teaches you some operations of system functions.

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Only the most basic functions of the BLOG system are realized, and more complex functions are not considered. The key problem in the implementation of the system is how to store and extract the data. You can consider storing the data in a database or in a plain text file, each of which has its own advantages and disadvantages. The BLOG system instance built here will use text files to store all data, including all log articles, personal introduction information, etc., in text files.

The front-end page is built in HTML language, and the page layout will be implemented through CSS+DIV (layer). The actual content of the BLOG will be displayed by the PHP code embedded in the HTML.

Data storage and system architecture

When you use text to store BLOG data, you will first encounter two key questions: what kind of data to save in the file and where to save the file. According to the implementation of the BLOG system, these two problems are discussed respectively.

(1) the essence of what data is stored in the file is how to organize the data. The most basic components of a log should include: the title of the log article, the date and time when the log article was published, and the actual content of the log article. Therefore, at least these three items of data should be stored in the file. When these three items of data are stored in the file, it is also necessary to be able to distinguish what each of the three items of data means. In view of the above analysis, the data is stored in the file in the format of "log title | log date time | log actual content". After the program reads the data from the file, it can distinguish the meaning of each data according to the vertical bar. It is convenient to extract and display the data on the page.

When a user submits a log, the program will organize the content submitted by the user into a file in the format of "log title | log date time | log actual content". And the program acts as the name of the file according to the current date and time of the system. For example, logs created at 12:47:07 on the 5th of a month will be saved to file 05-124707.txt.

(2) after the file for storing data is created, it should be stored in a certain location for the program to read. Consider creating a directory called contents for all the log content, and then creating a directory under the contents directory by year and month, which will be used to store logs for different years and months. For example, the log files of December 2011 are stored in the 201112 directory under the contents directory. The architecture of this BLOG system data storage is shown more clearly in the figure.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report