define('APPID','wx2xxxxx');
     define('APPSECRET','xxxxxxxxxx');
     $tokenFile = './tokenFile.txt';
        $data = json_decode(file_get_contents($tokenFile));
        if($data->expire_time < time() or !$data->expire_time){
            
         $curl = curl_init();
            $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.APPID.'&secret='.APPSECRET;
            curl_setopt($curl,CURLOPT_URL,$url);
            curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
            $res = curl_exec($curl);
            curl_close($curl);
            $access_token = json_decode($res)->access_token;
            print_r($access_token);
            
            if($access_token){
             $data['expire_time'] = time() + 7000;
                $data['access_token'] = $access_token;
                $fp = fopen($tokenFile,"w");
                fwrite($fp,json_encode($data));
                fclose($fp);
            }
        }else{
         $access_token = $data->access_token;
        }这里是错误提示:
Warning: fopen(./tokenFile.txt) [function.fopen]: failed to open stream: Permission denied in test.php on line 20Warning: chmod() [function.chmod]: Permission denied in test.php on line 21Warning: fwrite() expects parameter 1 to be resource, boolean given in test.php on line 23Warning: fclose() expects parameter 1 to be resource, boolean given in test.php on line 24