编程爱好者之家
public function clearAllMipCache(){ $api = 'https://c.mipcdn.com/update-ping/refreshcache'; $postData = array( "host"=>"m.test.com", "path"=>"/mip", "authkey"=>"s19b5607c83dcf", ); $postData = json_encode($postData); $url = $api; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); $result = curl_exec($ch); curl_close($ch); if($result['status']==0){ $this->success('清除成功',U('myadmin/mip/clearMipCache')); }else{ $this->error($result['msg'],U('myadmin/mip/clearMipCache')); } }
参数解析:
比如说你要清除的地址为: http://m.test.com/mip/123.html 你想清除掉 '/mip'目录下的mip缓存
'host':站点域名
'path':需要清理的路径
'authkey':站长平台申请的authkey