phpcms 定时更新首页、生成静态首页
2020-03-21 18:38:13V9二次开发
在phpcms根目录创建 : crond 目录。然后创建:create_index php
在phpcms根目录创建 : crond 目录。然后创建:create_index.php
- <?php
- //15分钟一次,生成首页
- // */15 * * * * php /data/wwwroot/www.phpip.com/www/crond/create_index.php
- set_time_limit(300);
- define('PHPCMS_PATH', substr(dirname(__FILE__),0,-6).DIRECTORY_SEPARATOR);
- if(file_exists(PHPCMS_PATH.'/phpcms/base.php')) {
- include PHPCMS_PATH.'/phpcms/base.php';
- } else {
- include PHPCMS_PATH.'phpcms/base.php';
- }
- $param = pc_base::load_sys_class('param');
- $html = pc_base::load_app_class('html','content');
- $size = $html->index();
- ?>
linux 下:
crontab -e
添加如下代码:
*/15 * * * * php /data/wwwroot/www.lve3.com/www/crond/create_index.php
每15分钟更新一次。
注意:路径自己修改。
