Exemplo n.º 1
0
 public static function del($bucket, $fileid, $userid = 0)
 {
     if (!$fileid) {
         return array('httpcode' => 0, 'code' => self::IMAGE_PARAMS_ERROR, 'message' => 'params error', 'data' => array());
     }
     $expired = 0;
     $url = self::generateResUrl($bucket, $userid, $fileid, 'del');
     $sign = TencentyunAuth::getAppSignV2($bucket, $fileid, $expired);
     $req = array('url' => $url, 'method' => 'post', 'timeout' => 10, 'header' => array('Authorization:QCloud ' . $sign));
     $rsp = TencentyunHttp::send($req);
     $info = TencentyunHttp::info();
     $ret = json_decode($rsp, true);
     if ($ret) {
         if (0 === $ret['code']) {
             return array('httpcode' => $info['http_code'], 'code' => $ret['code'], 'message' => $ret['message'], 'data' => array());
         } else {
             return array('httpcode' => $info['http_code'], 'code' => $ret['code'], 'message' => $ret['message'], 'data' => array());
         }
     } else {
         return array('httpcode' => $info['http_code'], 'code' => self::IMAGE_NETWORK_ERROR, 'message' => 'network error', 'data' => array());
     }
 }