当前位置:Gxlcms > PHP教程 > 腾讯对象存储PHP实践之上传php创建对象php面向对象练习题phpjson对

腾讯对象存储PHP实践之上传php创建对象php面向对象练习题phpjson对

时间:2021-07-01 10:21:17 帮助过:17人阅读

贴代码先

$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 <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了腾讯对象存储PHP实践之上传,包括了php,对象方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

  • 人气教程排行