Home >Backend Development >PHP Tutorial >Solution to publish articles regularly in phpcms_PHP Tutorial
Add the following function
/*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(); //初始化的时候调用定时功能 }
Step 4: Publish article
When publishing an article, select Review on the right, and then the time will be when the article will be automatically published
The system will determine if the time is up, the article will be automatically approved and published
This completes the content of articles published regularly by phpcms. If there are any bugs, please contact me in time. I publish them exclusively on Programmer Life Network. Please indicate the source for reprinting
Life is not easy, coders work hard