Hi
I didn’t sleep well last night. Although my dreams were sweet, I couldn’t sleep well and didn’t have the energy to do scientific research. . .
1. jQuery
12. Implement chat room creation
12.1 Basic functions
Login;
Real-time communication without refreshing;
Support emoticons.
12.2 Approximate effect
Login——》verification, plan to use ajax;
Chat——》php can implement specific functions.
12.3 Data flow analysis
Login page: Obtain username and password to request login - return to chat page or failure information and login page;
Chat page: Request and return of chat content (to achieve updated data without refreshing); Online personnel Request and return of information; handle requests to send content and write chat content.
12.4 Landing page development
--------Suddenly I found that I need the knowledge reserve of ajax, but I don’t want to read ajax today, I’ll come back on the weekend. . . -----------
2. PHP realizes page staticization (1)
1. Introduction to staticization
1.1. Dynamic pages and static pages
Dynamic: execute dynamic programs, php, jsp etc.; such as PHP, syntax analysis, compilation and then running.
Static: html and other files.
1.2. About optimizing page response time
--Main means
Staticization of dynamic pages--the focus of this section;
Optimize database;
Use load balancing;
Use cache;
- - Staticization of dynamic pages
Scenario: Some content in the page does not change frequently;
Essence: Generate static HTML files; (Reduce the execution steps, which saves time)
Reduce response time, the important thing is to reduce Server burden.
Not suitable for Weibo and other websites that update quickly.
1.3 About setting the static form of dynamic URL address
http://state.com/index.php?c=play&a=index&id=8123
becomes
http://state.com/play/8123.shtml
This process is still pseudo-static for the time being (actually it is still a dynamic file, just with a different vest).
1.4 PHP static
--Pure static
Real static files generated by php program.
is divided into local pure static (/local dynamic, the implementation method may be asynchronous operation of ajax) and global pure static.
--Pseudo-static
Convert the URL address into something like html.
2. Pure static case implementation
2.1 buffer
--Overview
is actually a buffer, a memory address space used to store data.
To achieve staticization, it should be centered around the buffer.
For example, the buffer in the computer system means that when there is data to be stored, a buffer needs to be filled first and then written to the disk.
--Process
Content-php buffer-tcp-Terminal
--Use
echo 1;echo "
";
echo ob_get_contents();
If it is not enabled, either change php.ini or add a header file
ob_start();
2.2 to achieve pure staticization
--the basic method
file_put_contents()
output_buffering()
The above has introduced the feeling of not sleeping well -shenmedoumeixie, including the ajax content. I hope it will be helpful to friends who are interested in PHP tutorials.