@@ -49,9 +49,9 @@ 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 ();
54-
52+ // require_once dirname(__FILE__).'/ FileCache/src/FileCache.php';
53+ // $this->Cache = new FileCache();
54+
5555 }
5656
5757 /**
@@ -67,7 +67,7 @@ public function return_access_token(){
6767 */
6868 private function get_access_token (){
6969
70- $ data = $ this ->Cache ('access_token_data ' );
70+ $ data = $ this ->cache ('access_token_data ' );
7171 if ($ data ){
7272 //从缓存中取
7373 $ access_token = $ data ['access_token ' ];
@@ -85,7 +85,7 @@ private function get_access_token(){
8585 $ data = $ this ->return_data ($ data );
8686 if ($ data ){
8787 $ access_token = $ data ['access_token ' ];
88- $ this ->Cache ('access_token_data ' , $ data , $ data ['expires_in ' ] - 100 );
88+ $ this ->cache ('access_token_data ' , $ data , $ data ['expires_in ' ] - 100 );
8989 return $ access_token ;
9090 }else {
9191 return false ;
@@ -229,7 +229,7 @@ public function get_auth_user($openid , $access_token , $lang = 'zh_CN'){
229229 */
230230 public function return_data ($ data ){
231231
232- if ($ data ['errcode ' ]){
232+ if (isset ( $ data ['errcode ' ]) ){
233233 $ this ->error = $ data ['errmsg ' ];
234234 return false ;
235235 }else {
@@ -337,7 +337,8 @@ public function http_post($url, $fields, $data_type='json') {
337337 */
338338 public function cache ($ key , $ value = null , $ expire = 3600 ){
339339
340- $ cache = $ this ->Cache ;
340+ require_once dirname (__FILE__ ).'/FileCache/src/FileCache.php ' ;
341+ $ cache = new \fileCache ();
341342
342343 if ($ value ){
343344 $ result = $ cache ->set ($ key , $ value , $ expire );
@@ -351,7 +352,9 @@ public function cache($key , $value = null , $expire = 3600){
351352
352353 public function cacheClear ($ key = null ){
353354
354- $ cache = $ this ->Cache ;
355+ require_once dirname (__FILE__ ).'/FileCache/src/FileCache.php ' ;
356+ $ cache = new \fileCache ();
357+
355358 if ($ key ){
356359 $ have = $ cache ->isHave ($ key );
357360 if ($ have ){
0 commit comments