石家庄seo培训:php168首页动态生成临时静态HTM的代码

时间:2009-07-04 10:41来源:网络营销管理学院 作者:网络营销专家 点击:次 [收藏到本地收藏夹]
一直想加快PHP168系统首页的显示速度,现在终于可以如愿了。方法如下。 一,对原来的首页动态index.php文件进行改造,代码如下: <?php ob_start(); //首页生成静态的htm,在开始处加入 ob_start(),打开缓冲区 //--- require_once('./global.php'); if($webdb[indexhtml

一直想加快PHP168系统首页的显示速度,现在终于可以如愿了。方法如下。
一,对原来的首页动态index.php文件进行改造,代码如下:

<?php
ob_start(); //首页生成静态的htm,在开始处加入 ob_start(),打开缓冲区

//---
require_once('./global.php');
if($webdb[indexhtml]>0){                             //生成静态,
  header("location:index_tpl.php?type=1");
}

if( file_exists(PHP168_N."template/$stylefile/index.php") ){     //功能扩展
  require_once(PHP168_N."template/$stylefile/index.php");
}else{
  require_once(PHP168_N."template/php168/index.php");
}

require_once(html("css"));
require_once(html("head"));
require_once(html("index"));
require_once(PHP168_N."foot.php");

//-----
$temp = ob_get_contents(); //得到缓冲区的内容并且赋值给变量$temp

织梦好,好织梦


ob_end_clean();

//写入首页index.htm文件
$fp = fopen('index.htm','w'); //打开要写的文件指针
fwrite($fp,$temp); //写信息到文件
fclose($fp); //关闭文件指针


//调用首页index.htm文件
if(file_exists('index.htm')){
header("location:index.htm");
}
?>

二,对httpd.conf文件进行索引修改(注意:WAPM系统要修改vhost.conf文件):
找到DirectoryIndex 把index.php 放在最前面即:

DirectoryIndex index.php index.htm index.html

把index.php放在最前面才能自动更新页面。

dedecms.com

 

织梦内容管理系统

 

织梦好,好织梦

  copyright dedecms

     更多精彩:http://www.cnseoo.net                  www.hbmobiles.cn

copyright dedecms

顶一下
(0)
0%
踩一下
(0)
0%
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
营销百科 娱乐资讯

济南办证 天津办证 郑州办证 洛阳办证