public function clearFileCache($fileurl)
 {
     $c = $this->getClient();
     $req = new Cdn20141111RefreshObjectCachesRequest();
     $req->setObjectType("File");
     // or Directory
     $req->setObjectPath($fileurl);
     try {
         $resp = $c->execute($req);
         //             if(!isset($resp->Code))
         //             {
         //                 //刷新成功
         //                 echo($resp->RequestId);
         //                 print_r($resp);
         //             }
         //             else
         //             {
         //                 //刷新失败
         //                 $code = $resp->Code;
         //                 $message = $resp->Message;
         //             }
     } catch (Exception $e) {
         // TODO: handle exception
     }
 }
Exemple #2
0
    $resp = $c->execute($req);
    if (!isset($resp->Code)) {
        //开通成功
        echo $resp->RequestId;
        print_r($resp);
    } else {
        //开通失败
        $code = $resp->Code;
        $message = $resp->Message;
    }
} catch (Exception $e) {
    // TODO: handle exception
}
//刷新缓存
$req = new Cdn20141111RefreshObjectCachesRequest();
$req->setObjectType("File");
// or Directory
$req->setObjectPath("www.yourdomain.com/path/filename.ext");
try {
    $resp = $c->execute($req);
    if (!isset($resp->Code)) {
        //刷新成功
        echo $resp->RequestId;
        print_r($resp);
    } else {
        //刷新失败
        $code = $resp->Code;
        $message = $resp->Message;
    }
} catch (Exception $e) {
    // TODO: handle exception