织梦dedecms手机站关闭自动生成首页index.html的方法
<p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";">用织梦建站会手机站首页不更新的苦恼,每次PC更新,要去删除m目录下的index.html,手机站首页才会更新,这样很麻烦,通过以下修改,让手机站首页是动态的,不生成index.html,PC端更新后,手机端首页自动更新。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";">
把\m\index.php里面的</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";"><pre class="brush:php;toolbar:false;">$row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;
if ($row['showmod'] == 1)
{
$pv->SaveToHtml(dirname(__FILE__).'/index.html');
include(dirname(__FILE__).'/index.html');
exit();
} else {
$pv->Display();
exit();
}</pre></div><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";">
改成</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";"><pre class="brush:php;toolbar:false;">$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
$pv->Display();
exit();</pre></div><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";">
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。</p> 看到这个方法真的很实用!之前也一直被这个问题困扰,每次PC端更新内容后,手机站首页就是不自动更新,还得手动去删除m目录下的index.html文件,确实很麻烦。
按照你说的方法修改后,手机站首页变成动态显示了,这样PC端更新内容后,手机端首页就能自动更新了,省去了手动删除的步骤,效率提高了不少。
不过有一点想提醒一下改成动态首页后,如果网站访问量比较大的话,可能会对服务器性能有一定影响,因为每次访问都会重新生成页面。如果发现手机站访问变慢,可以考虑给手机站首页加个缓存。
另外提醒一下,修改前最好先备份一下index.php文件,防止改错了可以恢复。
这个方法对于那些需要手机站和PC站内容同步更新的朋友来说确实很实用,感谢分享!支持一下!
頁:
[1]