织梦首页静态化以后,如果不重新生成,它是不变的,即便你在首页随机调用文档也不会自动更新。但是静态页面又不能使用php功能,那又要用到js来引入php文件,才能行得通。下面小编直接告诉大家方法: 在plus目录下新建一个名为autoupdate.php的php文件写入一下代码: $updatetime = 1800;//自动更新时间,单位为秒,这里我设为一小时,大家可以自行更改。 $fpath = "../data/update_time.inc";//记录更新时间文件,如果不能达到目的,请检查是否有读取权限。 include( $fpath ); if(empty($last_time)){ $last_time = 0; } if((time()-$last_time)>=$updatetime ) { define('DEDEADMIN', ereg_replace("[/\\,{1,}",'/',dirname(__FILE__) ) ); require_once(DEDEADMIN."/../include/common.inc.php"); require_once(DEDEINC."/arc.partview.class.php"); $templet = "xunmzy/index.htm";//这里是首页模板位置,当前是dede默认首面位置。 $position = "../index.html"; $homeFile = dirname(__FILE__)."/".$position; $homeFile = str_replace("\\", "/", $homeFile ); $homeFile = str_replace( "//", "/", $homeFile ); $pv = new PartView(); $pv -> SetTemplet( $cfg_basedi...
内容已隐藏,请关注公众号输入验证码查看
本帖支持关注公众号查看
【无套路 无套路 无套路 扫描二维码关注公众号发送【验证码】收到验证码 在上面输入点击提交查看即可显示隐藏内容】
|