本文整理汇总了PHP中Category_Model::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Category_Model::instance方法的具体用法?PHP Category_Model::instance怎么用?PHP Category_Model::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category_Model
的用法示例。
在下文中一共展示了Category_Model::instance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new Category_Model();
}
return self::$instance;
}
示例2:
/**
* 单例模式
* @return Category_Model
*/
public static function &instance()
{
if (!isset(self::$instance)) {
// Create a new instance
self::$instance = new Category_Model();
}
return self::$instance;
}
示例3: __construct
/**
* 构造函数
*/
public function __construct()
{
//必须继承父类控制器
parent::__construct();
//实例化模型
$this->model = Category_Model::instance();
$this->model->set_from($this->source, $this->appid, $this->device_id, $this->phone_model);
$this->_check_request();
}
示例4: do_task
/**
* 执行清空缓存
* @return void
*/
public function do_task()
{
if (!empty($this->task_data)) {
$user_id = $this->task_data['user_id'];
$added_ids = $this->task_data['added_ids'];
$updated_ids = $this->task_data['updated_ids'];
$deleted_ids = $this->task_data['deleted_ids'];
$recycled_ids = $this->task_data['recycled_ids'];
$ids = array_merge($added_ids, $updated_ids, $deleted_ids);
if ($updated_ids or $recycled_ids or $deleted_ids) {
$this->update_cache($user_id, 'recycled_list_update');
}
if (!empty($ids) or $this->is_snapshot) {
Category_Model::instance()->clear_cache($user_id);
}
if (!empty($ids)) {
foreach ($ids as $id) {
$this->cache->delete($this->cache_pre . 'find_by_id_' . $user_id . '_' . $id);
}
$this->cache->delete($this->cache_pre . 'get_list_' . $user_id);
$this->cache->delete($this->cache_pre . 'get_count_' . $user_id);
Friend_Model::instance()->del_user_link_cache($user_id);
}
}
}