ICANN认证国际域名顶级注册机构
网站建设,域名注册,空间租用,软件销售,广告设计 域名注册,空间租用, 网站建设,东莞网页设计,域名注册,网站推广,网站开发,网页设计 网站推广,,百度推广,新浪推广,雅虎推广,网易推广 标志设计,画册设计,包装设计,VI策划,企业形象顾问 连邦软件加盟店,提供销遥行,管家婆,速达,用友ERP,诺顿等软件报价及销售 建站必读 腾达网络,上网帮助中心, 腾达为东莞等地,提供网站建设,网站推广,广告设计,软件销售等优质服务!
建站必读


 
 
当前位置:首页 -> 建站必读 -> PHP技术
Script Caching with PHP
Intended Audience

Introduction

The Caching Imperative

The Script Caching Solution

The Caching Script

Implementation: Avoiding Common Pitfalls

Summary

The Script

About the Author



Intended Audience

This article is intended for the PHP programmer interested in creating a static HTML cache of dynamic PHP scripts. The article has been written specifically for an Apache server running PHP scripts, but the ideas described here are applicable to almost any Web environment.



The article assumes that you have some experience with creating dynamic Web sites and that you are familiar with HTTP – at least enough to know what a "404 Page Not Found" error means and the definition of the environment variables $REQUEST_URI and $DOCUMENT_ROOT.



Introduction

The benefits to using dynamic Web pages are well known, but there are nonetheless two significant drawbacks: speed and search engine accessibility.



Speed: The speed in which a user receives a page after clicking a link or entering a URL is a crucial factor for a Website. It depends on dozens of variables, some of which you may have control over and some of which you don’t. There are countless bottlenecks in the process, and it’s probably impossible to fix them all. This bottleneck we will tackle here is the one caused by waiting for the server side scripts to create the HTML output.





Search Engine Accessibility: By this I mean the ability of search engines to point to a particular Web page. Most search engines function by using a "Crawler" program. Crawler programs begin on a certain page and navigate through the links on it. Every page a crawler visits is then indexed on the search engine’s database.

Most crawlers, however, are only programmed to navigate through static (HTML) pages – not dynamic ones. So, for example, pages with URLs that contain a "?" character (indicating a query string) or a filename ending with ".php" will not be accessed. Consequently, crawlers will not index these pages, making your site less accessible to new visitors.





Note: A crawler cannot tell the difference between an HTML file’s output and a PHP file’s. They both send the same content type. Therefore, most crawlers simply decide according to the filename and/or if there is a query string in the URL – that is, if the URL contains a "?".



This article discusses a procedure for dealing with both of these drawbacks. The article’s script should be sufficient for use under most circumstances – but in particular, small scale Web sites and individual script pages that are only moderately subject to change (dynamics).



The Caching Imperative

Simply speaking, caching entails storing the output of one or more dynamic scripts into static HTML files. A visitor to your site would be directed to these HTML files rather than to their original dynamic versions.



The mechanism for doing so can be described using a Magazine’s Web site as an example.



A Magazine’s Web site would likely have a database that contained numerous articles and stories. You would normally have a script (say "show_article.php") that:



Receives an article ID number

Reads the article’s content from the database

Puts it into some kind of HTML template

Formats the whole page with navigation links etc...

Sends the resulting HTML to the visitor’s browser

As such, in the site’s homepage you might have links to current articles coded as follows:



<a href="show_article.php?id=123">Cache Article</a>

Now, articles tend to be static and you would hope that the site was operating under heavy request loads (because it’s popular!!). Consequently, requests for each article would undergo extensive processing – meaning access database, search article, and display it.



Moreover, when you depend on other database information such as layout specifications, then the pr
 
 
本站关键词:
|东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞||东莞VI设计|东莞企业形像设计|东莞产品包装设计|东莞海报设计|东莞PHP主机|东莞动态空间|东莞动态网页|网站建设 东莞|网页设计 东莞|东莞国际域名注册|东莞国内域名|网页空间申请 东莞|
域名注册 | 虚拟主机 | 网站建设 | 网站推广 | 广告设计 | 帮助中心 | 软件中心 | 关于腾达
东莞市腾达信息工程有限公司      本站网络实名: 东莞网站建设
地址:东莞市新城市中心区第一国际B座610   邮编:523007
电话:0769-22026071 22026072 传真:0769-22026076 24小时服务热线:13712032014
© 2002~2005 腾达网络   版权所有