bin.shen
2016-12-05 a4c9331bbfe3e8765ccdc1c54cc6931bac49cc82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
/**
 *  微信公众平台PHP-SDK, Codeigniter实例
 *  @author nigelvon@gmail.com
 *  @link https://github.com/dodgepudding/wechat-php-sdk
 *  usage:
 *  $this->load->library('CI_Wechat');
 *  $this->ci_wechat->valid();
 *  ...
 *
 */
require_once('wechat.class.php');
 
class CI_Wechat extends Wechat {
    protected $_CI;
    public function __construct() {
        $this->_CI =& get_instance();
//        $this->_CI->config->load('wechat');
//        $options = $this->_CI->config->item('wechat');
        $options = array();
 
        $this->_CI->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
 
        parent::__construct($options);
    }
 
    /**
     * 重载设置缓存
     * @param string $cachename
     * @param mixed $value
     * @param int $expired
     * @return boolean
     */
    protected function setCache($cachename, $value, $expired) {
        return $this->_CI->cache->save($cachename, $value, $expired);
    }
 
    /**
     * 重载获取缓存
     * @param string $cachename
     * @return mixed
     */
    protected function getCache($cachename) {
        return $this->_CI->cache->get($cachename);
    }
 
    /**
     * 重载清除缓存
     * @param string $cachename
     * @return boolean
     */
    protected function removeCache($cachename) {
        return $this->_CI->cache->delete($cachename);
    }
}
 
/* End of file CI_Wechat.php */
/* Location: ./application/libraries/CI_Wechat.php */