腾讯对象存储PHP实践之上传 php 创建对象 php面向对象练习题 php json对
程序员文章站
2022-06-10 17:51:31
...
贴代码先
$file_name = 'test.jpg';
$upload_url = 'web.file.myqcloud.com/files/v1/10039609/wechat/cover/' . $file_name;
$exp = time() + 600;
$sign = 'a=10039609&b=wechat&k=AKIDqybsVwxcwSeGYJTsLElPdjgFGa5aPGso&e=' . $exp . '&t=' . time() . '&r=' . rand() . '&f=/10039609/wechat/cover/' . $file_name;
$sign = base64_encode(hash_hmac('SHA1', $sign, 'prbaqNGhrNinShbRWXqfT10wpCFs68hu', true) . $sign);
$post_data = [
'op' => 'upload',
'filecontent' => file_get_contents('https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png'), // baidu logo];
$header = [
'Content-Type: multipart/form-data',
'Authorization: ' . $sign,
];
$ch = curl_init($upload_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$res = curl_exec($ch);
echo''
;
print_r(json_decode($res, true));
').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i ').text(i));
};
$numbering.fadeIn(1700);
});
});
以上就介绍了腾讯对象存储PHP实践之上传,包括了php,对象方面的内容,希望对PHP教程有兴趣的朋友有所帮助。