美文网首页
获取taoken保存为txt

获取taoken保存为txt

作者: 小进我是爸爸 | 来源:发表于2020-08-14 09:29 被阅读0次


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);
    }

相关文章

网友评论

      本文标题:获取taoken保存为txt

      本文链接:https://www.haomeiwen.com/subject/foowdktx.html