您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

upyun 刷新缓存的签名不知道哪错了

2024/3/17 21:25:58发布24次查看
返回的结果是401 sign error
public function delete($path) { //比如http://www.xx.com/a/b.jpg,我传过来删除的就是/a/b.jpg //删除部分略过 //刷新缓存开始 $ch = curl_init('http://purge.upyun.com/purge/'); $date = gmdate('d, d m y h:i:s \g\m\t'); //这里签名我是直接用的$path,我是怀疑这里错了 但是我试过http://www.xx.com加在前面也还是错误 $sign = md5($path.'&'.$this->bucket.'&'.$date.'&'.md5($this->password)); //头信息 $header = array( 'expect: ', 'authorization: upyun '.$this->config['bucket'].':'.$this->config['username'].':'.$sign, 'date: '.$date, 'content-type: application/x-www-form-urlencoded', ); curl_setopt($ch,curlopt_httpheader,$header); //post方式 curl_setopt($ch,curlopt_post,1); //这里也是个问题,我不知道这个要不要提交过去 $data = array( 'purge' => urlencode($path), ); curl_setopt($ch,curlopt_postfields,$data); //是否返回头信息 curl_setopt($ch,curlopt_header,1); $response = curl_exec($ch); $status = curl_getinfo($ch,curlinfo_http_code); curl_close($ch); //打印结果 var_dump($response);}

回复内容: 返回的结果是401 sign error
public function delete($path) { //比如http://www.xx.com/a/b.jpg,我传过来删除的就是/a/b.jpg //删除部分略过 //刷新缓存开始 $ch = curl_init('http://purge.upyun.com/purge/'); $date = gmdate('d, d m y h:i:s \g\m\t'); //这里签名我是直接用的$path,我是怀疑这里错了 但是我试过http://www.xx.com加在前面也还是错误 $sign = md5($path.'&'.$this->bucket.'&'.$date.'&'.md5($this->password)); //头信息 $header = array( 'expect: ', 'authorization: upyun '.$this->config['bucket'].':'.$this->config['username'].':'.$sign, 'date: '.$date, 'content-type: application/x-www-form-urlencoded', ); curl_setopt($ch,curlopt_httpheader,$header); //post方式 curl_setopt($ch,curlopt_post,1); //这里也是个问题,我不知道这个要不要提交过去 $data = array( 'purge' => urlencode($path), ); curl_setopt($ch,curlopt_postfields,$data); //是否返回头信息 curl_setopt($ch,curlopt_header,1); $response = curl_exec($ch); $status = curl_getinfo($ch,curlinfo_http_code); curl_close($ch); //打印结果 var_dump($response);}

$path 后面加 \n,类似:http://www.xx.com/a/b.jpg\n
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product