Detailed description of PHP's Smarty cache operations
Source: Internet
Author: User
In details about PHP's Smarty cache operations (1) and PHP's Smarty cache operations (2), we have learned about the smarty global cache and some cache operations. Now let's take a look at the last partial cache operation. in details about PHP's Smarty cache operation (1) and PHP's Smarty cache operation (2) we have learned how to perform the smarty global cache and partial cache operations. Now let's take a look at the last local cache operation.
######################################## #################
3. local cache
First, let us understand the meaning of local cache, that is, to specify some local locations under the same page to generate a cache.
Here we also need to reverse our thinking.
In fact, it is not to specify which local caches are generated, but which ones are not generated (this is similar to the operation idea of some caches ).
Let's just say, let's take an instance first.
++ ++
1. php
$ Time = time ();
$ Smarty-> assign ('time', $ lanmuarr );
Function insert_timeget ()
{
Return time ();
}
$ Smarty-> display('1.html ');
++ ++
1. html
{$ Time}
// Refresh the cache repeatedly.
{Insert name = 'timeget '}
// When the cache is enabled, refresh it again.
++ ++
After understanding the example, let's explain the principle.
In PHP, we only need to define a UDF named insert _ custom supplementary name. The value returned in the UDF does not need to be passed through the assign () method, you can directly use {insert name = 'custom supplemental name'} on the template page without being affected by the cache, and refresh the page in real time.
######################################## #################
Now we have forgotten all about the cache methods in smarty 3. if you are interested, you can try different effects on your own.
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service