PHP: time (), date (), mktime () date and time function libraries are often forgotten. here, you can add them to your favorites for convenience: checkdate: to verify the correctness of the date.
Date: format the server time.
Strftime: format the
We often optimize cache settings on servers, but we seldom notice thatClient CacheTo be precise, it is the browser cache mechanism.In fact, each browser has a cache policy, which temporarily caches each browsed file in a special folder. When you
Description
1, the server caches the compressed files, re-accesses reduce the re-compression time, reduce CPU utilization.
2, by setting the client file cache time, reduce the number of re-requests, can be reduced by more than 85%.
3, image because
Whether you use PHP to open the browser cache or use the APACHE,IIS server environment to configure we will be for the browser Cache-control to operate, let me introduce you to PHP settings picture browser cache
Cache-control
Cache-control is the
DescriptionAfter the server caches the compressed files, the re-accesses reduce the re-compression time and reduce the CPU usage. By setting the client file cache time, reduce the number of requests again, can be reduced by more than 85%. Picture
Description
1, the server caches the compressed files, again access reduces the time to compress, reduce the CPU occupancy rate.
2, by setting the client file cache time, reduce the number of requests again, can be reduced by more than 85%.
3,
Checkdate:
Verify the correctness of the date.
Date:
Format the time of the server.
Strftime:
The time of the server is formatted locally.
GETDATE:
Get time and date information.
Method 1: Get the current date and time in the PHP code before inserting the databaseBy default, PHP interprets the display time as "Greenwich Mean Time", which is 8 hours different from our local time.
So the time obtained by date ("Y-m-d h: I: s")
We often optimize cache settings on the server, but we seldom pay attention to the client cache, accurate to the browser cache mechanism.
In fact, each browser has a cache policy, which temporarily caches each browsed file in a special folder. When
PHP: time (), date (), mktime () date and time function libraries are often forgotten. here, you can add them to your favorites for convenience: checkdate: to verify the correctness of the date.
Date: format the server time.
Strftime: format the
The PHP version of the website cache to speed up the opening of the way to share, the need for friends can refer to the following instructions:
1. the compressed files are cached on the server, and the re-access reduces the re-compression time to
such as: The time is exactly 5 minutes ago, then the corresponding timestamp will be formatted as 5 minutes ago, not much to say, directly affixed to the code:
Copy CodeThe code is as follows:
/**
* Format time
* @param integer $timestamp timestamp
such as: The time is exactly 5 minutes ago, then the corresponding timestamp will be formatted as 5 minutes ago, not much to say, directly affixed to the code:
Copy CodeThe code is as follows:
/**
* Format time
* @param integer $timestamp timestamp
Note:
1. the compressed files are cached on the server, and the re-access reduces the re-compression time to reduce the CPU usage.
2. You can set the Client File Cache Time to reduce the number of re-requests by more than 85%.
3. Because the image
The PHP version of the website cache to speed up the opening of the way to share, the need for friends can refer to the following instructions:
1. the compressed files are cached on the server, and the re-access reduces the re-compression time to
Php custom format time sample code. For example, if the time is 5 minutes ago, the corresponding timestamp will be formatted as 5 minutes ago. if you don't need to talk about it, paste the code directly: Copy the code as follows: * ** format Time * @
Php enables gzip compression to accelerate the website
Note:After the compressed files are cached on the server, the re-access will reduce the re-compression time and reduce the CPU usage. By setting the client file cache time, you can
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.