Dynamic language static

Source: Internet
Author: User

first, what is dynamic language static
1, the existing PHP and other dynamic language logic code into a static HTML file, the user access to dynamic script redirection to the static HTML file process;
2, the implementation of the requirements of the page, only to do dynamic language static;
second, why to static
1, the dynamic script will usually do logical calculation and data query, the greater the amount of traffic, the greater the server pressure;
2, the heavy traffic may cause the CPU load is too high, the database server pressure is too large;
3, static can reduce the logic processing pressure, reduce the database server query pressure
Third, the realization mode of static
Smarty:
$smarty->cache_dir = $ROOT. " cache/"; Cache directory
$smarty->caching = true; whether to turn on caching
$smarty->cache_lifetime = ' 3600 '; cache time: unit is seconds
$smarty->display () load template
$smarty->clear_all_cache () clears all caches
$smarty->clear_cache (' file.html ') clears the specified cache
$smarty->clear_cache (' a.html ', $id) clears the cache of the specified cache number under the same template;
ob function:
ob_start () Open output control buffer
ob_get_ontents () returns the contents of the output buffer
ob_clear () empty buffer
Ob_end_flush () flushes out buffer contents and turns off buffering
you can determine the inode modification time of a file and determine whether it expires with Filectime ()
Example:

Dynamic language static

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.