phpcms定时发布文章解决办法
phpcms更新文章是一件比较繁琐的事情,如果phpcms能有定时更新文章的功能就好了。这样就可以一次把文章都写好,规定发布时间剩下的事情就交给系统了,通过最近的研究,还真有这种方法。第一步:代码修改
打开phpcms\modules\content\index.php
加入下面函数
/*wlsh 定时发布文章设置 来源程序员人生 www.wfuyu.com 说明: 文章要设置一级审核 并且发布的时候时间要大于当前时间 */ public function dingshi() { $this->content_check_db = pc_base::load_model('content_check_model'); $ids = $this->content_check_db->select('status=1 and username="admin" and inputtime<='.SYS_TIME,'checkid'); if(!empty($ids)){ foreach($ids as $k){ $k1 = explode('-',$k['checkid']); $this->db->set_model($k1[2]); $this->db->status($k1[1]); } } }
第二步:在构造函数中加入调用
function __construct() { $this->db = pc_base::load_model('content_model'); $this->_userid = param::get_cookie('_userid'); $this->_username = param::get_cookie('_username'); $this->_groupid = param::get_cookie('_groupid'); $this->dingshi(); //初始化的时候调用定时功能 }
第三步:文章设置一级审核
后台->内容相关设置->栏目管理->修改栏目
第四步:发布文章
发布文章的时候,右边要选择审核,然后时间就是文章自动发布的时间了
系统会判断,如果到时间了,文章就会自动审核通过,也就发布了
到此就完成了phpcms定时发布文章的内容了,有什么bug及时与我联系,本人由程序员人生网独家发布,转载请说明出处
生活不易,码农辛苦
如果您觉得本文的内容对您的学习有所帮助,可以手机扫描二维码进行捐赠

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
