function huodetoken(){
$url='';
$myfile = fopen("testfile.txt", "r");
if($myfile){
$data=fread($myfile,filesize("testfile.txt"));
$data = json_decode($data,true);
if(time()-$data['time']>7200 || $data['access_token']){
$data=httpsends_get($url);
$data = json_decode($data,true);
$myfile = fopen("testfile.txt", "w");
$data['time']=time();
$data = json_encode($data,true);
fwrite($myfile, $data);
}
}else{
$data=httpsends_get($url);
$data = json_decode($data,true);
$myfile = fopen("testfile.txt", "w");
$data['time']=time();
$data = json_encode($data,true);
fwrite($myfile, $data);
}
网友评论