public function put($files) { $ret = array(); $HttpReuqst = new Request('http://up.qiniu.com', 'POST'); foreach ($files as $fileName => $filePath) { $newName = md5(microtime()); $ext = substr($fileName, strrpos($fileName, '.') + 1); //post字段 $fields = array('token' => $this->token, 'key' => $newName . '.' . $ext); $uploadFile = array(); $uploadFile[$fileName] = $filePath; $HttpReuqst->setPostFields($fields); $HttpReuqst->setPostFiles($uploadFile); $response = $HttpReuqst->send(); if ($response->getStatus() == 200) { $body = $response->getBody(); $body = json_decode($body, true); $ret[$fileName] = $this->policy->getURL($body['key']); } } return $ret; }