1、首先修改数据库结构



进入 ECSHOP后台 》 数据库管理 》SQL查询


输入下面SQL语句,提交,注意要把表前缀更改为你自己的。我这里使用的是默认表前缀ecs_。



INSERT INTO `ecs_shop_config` VALUES (65535, 10, 'last_clear_time', 'text', '', '', '1274090777', 1);



注:65535 这个值也是可以改的,但是不建议少于1000 如果少于1000,可能对其他值会产生影响。

 

 

2、打开 includes/init.php 这个文件在文件的最后添加如下代码:

 

--------------------------------------------------------------------------------

if (is_temps())


{

    clear_all_files();

    $sql="update ".$ecs->table('shop_config') ."set value=".time()." where code='"."last_clear_time '";

     $db->query($sql);

}


function is_temps()

{

    if(time()-$_CFG['last_clear_time']<10000)

    {

        return(false);

    }

    else

    {

        return(true);

    }

}

 

--------------------------------------------------------------------------------

上面代码中的10000 为自动更新间隔时间,单位为秒,


你可以根据自己网站的实际情况自行修改,比如改成 5000 或者20000。

 

相关文章:

  • 2021-11-17
  • 2021-07-09
  • 2021-05-26
  • 2022-12-23
  • 2021-06-29
  • 2022-01-02
  • 2021-12-20
  • 2022-12-23
猜你喜欢
  • 2021-05-17
  • 2022-12-23
  • 2021-05-20
  • 2021-10-09
  • 2021-09-30
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案