@@ -49,8 +49,6 @@ public function __construct($config){
4949 $ this ->redirect_uri = $ config ['redirect_uri ' ];
5050 $ this ->access_token = $ this ->get_access_token ();
5151
52- require_once 'FileCache/src/FileCache.php ' ;
53- $ this ->Cache = new FileCache ();
5452
5553 }
5654
@@ -229,7 +227,7 @@ public function get_auth_user($openid , $access_token , $lang = 'zh_CN'){
229227 */
230228 public function return_data ($ data ){
231229
232- if ($ data ['errcode ' ]){
230+ if (isset ( $ data ['errcode ' ]) ){
233231 $ this ->error = $ data ['errmsg ' ];
234232 return false ;
235233 }else {
@@ -337,7 +335,9 @@ public function http_post($url, $fields, $data_type='json') {
337335 */
338336 public function cache ($ key , $ value = null , $ expire = 3600 ){
339337
340- $ cache = $ this ->Cache ;
338+
339+ require_once 'FileCache/src/FileCache.php ' ;
340+ $ cache = new FileCache ();
341341
342342 if ($ value ){
343343 $ result = $ cache ->set ($ key , $ value , $ expire );
@@ -351,7 +351,9 @@ public function cache($key , $value = null , $expire = 3600){
351351
352352 public function cacheClear ($ key = null ){
353353
354- $ cache = $ this ->Cache ;
354+ require_once 'FileCache/src/FileCache.php ' ;
355+ $ cache = new FileCache ();
356+
355357 if ($ key ){
356358 $ have = $ cache ->isHave ($ key );
357359 if ($ have ){
0 commit comments