这就是 go 写的太多的缘故吧

2019-05-05  本文已影响0人  追风骚年
public function execute($bucket, $key, $fops, $pipeline = null, $notify_url = null, $force = false)
{
    if (is_array($fops)) {
        $fops = implode(';', $fops);
    }
    $params = array('bucket' => $bucket, 'key' => $key, 'fops' => $fops);
    \Qiniu\setWithoutEmpty($params, 'pipeline', $pipeline);
    \Qiniu\setWithoutEmpty($params, 'notifyURL', $notify_url);
    if ($force) {
        $params['force'] = 1;
    }
    $data = http_build_query($params);
    $scheme = "http://";
    if ($this->config->useHTTPS === true) {
        $scheme = "https://";
    }
    $url = $scheme . Config::API_HOST . '/pfop/';
    $headers = $this->auth->authorization($url, $data, 'application/x-www-form-urlencoded');
    $headers['Content-Type'] = 'application/x-www-form-urlencoded';
    $response = Client::post($url, $data, $headers);
    if (!$response->ok()) {
        return array(null, new Error($url, $response));
    }
    $r = $response->json();
    $id = $r['persistentId'];
    return array($id, null);
}

@七牛团队

上一篇 下一篇

猜你喜欢

热点阅读