色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

使用 php4 加速 web 傳輸

瀏覽:2日期:2024-01-16 18:52:25
<? /*************************************** ** Title.........: PHP4 HTTP Compression Speeds up the Web ** Version.......: 1.10 ** Author........: catoc <catoc@163.net> ** Filename......: gzdoc.php ** Last changed..: 25/08/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) <catoc@163.net> ** 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. ** Useage........: ** No space before the beginning of the first '<?' tag. ** ------------Start of file---------- ** |<? ** | include('gzdoc.php'); ** | print "Start output !!"** |?> ** |<HTML> ** |... the page ... ** |</HTML> ** |<? ** | gzdocout(); ** |?> ** -------------End of file----------- ***************************************/ ob_start(); ob_implicit_flush(0); function GetHeader(){ $headers = getallheaders(); while (list($header, $value) = each($headers)) { $Message .= "$header: $value<br>n"} return $Message; } function CheckCanGzip(){ global $HTTP_ACCEPT_ENCODING, $PHP_SELF, $Wget, $REMOTE_ADDR, $S_UserName; if (connection_timeout() || connection_aborted()){ return 0; } if ((strpos('catoc'.$HTTP_ACCEPT_ENCODING, 'gzip')) || $Wget == 'Y'){ if (strpos('catoc'.$HTTP_ACCEPT_ENCODING, 'x-gzip')){ $ENCODING = "x-gzip"$Error_Msg = str_replace('<br>','',GetHeader()); $Error_Msg .= "Time: ".date("Y-m-d H:i:s")."n"$Error_Msg .= "Remote-Address: ".$REMOTE_ADDR."n"//mail('your@none.net', "User have x-gzip output in file $PHP_SELF!!!", $Error_Msg); }else{ $ENCODING = "gzip"} return $ENCODING; }else{ return 0; } } function GzDocOut(){ global $PHP_SELF, $CatocGz, $REMOTE_ADDR, $S_UserName; $ENCODING = CheckCanGzip(); if ($ENCODING){ print "n<!-- Use compress $ENCODING -->n"$Contents = ob_get_contents(); ob_end_clean(); if ($CatocGz == 'Y'){ print "Not compress lenth: ".strlen($Contents)."<BR>"print "Compressed lenth: ".strlen(gzcompress($Contents))."<BR>"exit; }else{ header("Content-Encoding: $ENCODING"); } print pack('cccccccc',0x1f,0x8b,0x08,0x00,0x00,0x00,0x00,0x00); $Size = strlen($Contents); $Crc = crc32($Contents); $Contents = gzcompress($Contents); $Contents = substr($Contents, 0, strlen($Contents) - 4); print $Contents; print pack('V',$Crc); print pack('V',$Size); exit; }else{ ob_end_flush(); $Error_Msg = str_replace('<br>','',GetHeader()); $Error_Msg .= "Time: ".date("Y-m-d H:i:s")."n"$Error_Msg .= "Remote-Address: ".$REMOTE_ADDR."n"//mail('your@none.net', "User can not use gzip output in file $PHP_SELF!!!", $Error_Msg); exit; } } ?>
標簽: PHP
主站蜘蛛池模板: 日韩精品在线一区 | 特黄特黄一级高清免费大片 | 国产精品久久久久影视不卡 | 中文字幕精品在线观看 | 成人人免费夜夜视频观看 | 特级毛片a级毛免费播放 | 欧美私人网站 | 牛人国产偷窥女洗浴在线观看 | 日本亚欧乱色视频在线网站 | 日本精品一区二区三区在线 | 久久精品视频一区二区三区 | 美女张开双腿让男人桶 | 日韩欧美第一页 | 久久黄色视屏 | 韩日一区二区 | 国产视频合集 | 国产情侣真实露脸在线最新 | 99久久国产综合精品网成人影院 | 午夜视频久久 | 国产精品免费大片一区二区 | 在线观看久草视频 | 国产精选莉莉私人影院 | 最新欧美精品一区二区三区不卡 | 亚洲精品久久99久久一区 | 国产成人精品男人的天堂538 | 国产欧美一区二区三区在线 | 国产精品午夜波多野结衣性色 | 韩国一级毛片视频 | 欧美大胆a | 亚洲高清不卡 | 亚洲黄色官网 | 天天躁天天碰天天看 | 欧美日韩在线观看区一二 | 日本久久久久久久久久 | 日韩视频一区二区三区 | wwww.黄| 手机在线播放av | 免费成年人视频网站 | 日韩 欧美 自拍 在线 视频 | 一区二区三区在线看 | 亚洲成av人片在线观看无码 |