poscms初始化执行hooks
2024-11-23 18:51:00
<?php /** * 我的钩子定义配置 */ defined('BASEPATH') OR exit('No direct script access allowed'); /* $hook['钩子名称'][] = array( 'class' => '类名称', 'function' => '方法名称', 'filename' => '钩子文件.php', 'filepath' => 'hooks', ); */ /* $hook['member_register_before'][] = array( 'class' => 'register_phone_hooks', 'function' => 'index1', 'filename' => 'register_phone_hooks.php', 'filepath' => 'hooks', ); $hook['member_register_after'][] = array( 'class' => 'register_phone_hooks', 'function' => 'index2', 'filename' => 'register_phone_hooks.php', 'filepath' => 'hooks', ); */ $hook['poscms-init'][] = array( 'class' => 'Content_model', 'function' => 'remove', 'filename' => 'Content_model.php', 'filepath' => FCPATH . 'module/mall/models', );
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* v3.1.0 */ require FCPATH.'branch/fqb/C_Model.php'; class Content_model extends C_Model { /* * 构造函数 */ public function __construct() { parent::__construct(); } public function remove(){ $time = time()-30*24*60*60; //查询出超时的数据 然后更改 $this->db->where('inputtime <', $time)->update('imt_1_mall', array('status' => 0)); } }