日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

如何用PHP控制瀏覽器cache(4)_PHP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:解讀使用PHP4.2.0及以后版本的注意事項
從PHP 4.2.0版本開始中, PHP 指令 register_globals 的默認值為 off(在php.ini配置文件里). 這是 PHP 的一個主要變化。register_globals是干什么用的呢?它是PHP用來控制是否將EGPCS (Env

以下為引用的內(nèi)容:

Example 6. 加快傳輸

/*
** Title.........: PHP4 HTTP Compression Speeds up the Web
** Version.......: 1.20
** Author........: catoc
** Filename......: gzdoc.php
** Last changed..: 18/10/2000
** Requirments...: PHP4 >= 4.0.1
** PHP was configured with --with-zlib[=DIR]
** Notes.........: Dynamic Content Acceleration compresses
** the data transmission data on the fly
** code by sun jin hu (catoc)
** Most newer browsers since 1998/1999 have
** been equipped to support the HTTP 1.1
** standard known as "content-encoding."
** Essentially the browser indicates to the
** server that it can accept "content encoding"
** and if the server is capable it will then
** compress the data and transmit it. The
** browser decompresses it and then renders
** the page.
**
** Modified by John Lim ([email protected])
** based on ideas by Sandy McArthur, Jr
** Usage........:
** No space before the beginning of the first ' ** ------------Start of file---------
-
** │ ** │ include('gzdoc.php');
** │? >
** │
** │... the page ...
** │
** │ ** │ gzdocout();
** │? >
** -------------End of file-----------
*/
ob_start();
ob_implicit_flush(0);
function CheckCanGzip(){
global HTTP_ACCEPT_ENCODING;
if (headers_sent() ││ connection_timeout() ││ connection_aborted()){
return 0;
}
if (strpos(HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) return "x-gzip";
if (strpos(HTTP_ACCEPT_ENCODING,'gzip') !== false) return "gzip";
return 0;
}
/* level = compression level 0-9, 0=none, 9=max */
function GzDocOut(level=1,debug=0){
ENCODING = CheckCanGzip();
if (ENCODING){
print "\n\n";
Contents = ob_get_contents();
ob_end_clean();
if (debug){
s = "

Not compress length: ".strlen(Contents);
s .= "
Compressed length: ".strlen(gzcompress(Contents,level));
Contents .= s;
}
header("Content-Encoding: ENCODING");
print "\x1f\x8b\x08\x00\x00\x00\x00\x00";
Size = strlen(Contents);
Crc = crc32(Contents);
Contents = gzcompress(Contents,level);
Contents = substr(Contents, 0, strlen(Contents) - 4);
print Contents;
print pack('V',Crc);
print pack('V',Size);
exit;
}else{
ob_end_flush();
exit;
}
}
?>

這是catoc的一段很早以前的代碼,是在weblogs.com看到的,他利用了zlib的函數(shù),對傳輸?shù)膬?nèi)
容進行了壓縮,測試表明,對于10k以上的頁面,會產(chǎn)生效果,而且頁面越大,效果越明顯。

分享:淺析PHP4和PHP5的配置的異同
配置php4或者php5的過程中,php4,5的配置的步驟大致一樣的,但是配置內(nèi)容有一些差別。在LINUX等環(huán)境下編譯,一般來說,只要編譯的選項正確,配置也就正確了;在windows配置則需要注意以下

共4頁上一頁1234下一頁
來源:模板無憂//所屬分類:PHP教程/更新時間:2008-12-01
相關PHP教程