七牛SDK PHP挣扎两个小时 麻烦给个靠谱点的demo吧

WBOY
Release: 2016-06-06 20:46:50
Original
1115 people have browsed it

按照官方API提示这样写 就是给抛个错误 { error: 'bad auth'}或者error: "no such bucket" demo都是民间的 各种错误

<code><?php require_once("qiniu/rs.php");

$bucket = 'xxxxxx这个隐藏了';
$accessKey = 'xxxxxx';
$secretKey = 'xxxxxx';

Qiniu_SetKeys($accessKey, $secretKey);
$putPolicy = new Qiniu_RS_PutPolicy($bucket);
$upToken = $putPolicy->Token(null);

?>

    
      <form method="post" action="http://up.qiniu.com/" enctype="multipart/form-data">
        <input name="key" type="hidden" value="<resource key>">
        <input name="x:<custom_field_name>" type="hidden" value="<custom value>">
        <input name="token" type="hidden" value="<token>">
        <input name="file" type="file">
        ...
      </form>
    

</code>
Copy after login
Copy after login

这个问题已被关闭,原因:

回复内容:

按照官方API提示这样写 就是给抛个错误 { error: 'bad auth'}或者error: "no such bucket" demo都是民间的 各种错误

<code><?php require_once("qiniu/rs.php");

$bucket = 'xxxxxx这个隐藏了';
$accessKey = 'xxxxxx';
$secretKey = 'xxxxxx';

Qiniu_SetKeys($accessKey, $secretKey);
$putPolicy = new Qiniu_RS_PutPolicy($bucket);
$upToken = $putPolicy->Token(null);

?>

    
      <form method="post" action="http://up.qiniu.com/" enctype="multipart/form-data">
        <input name="key" type="hidden" value="<resource key>">
        <input name="x:<custom_field_name>" type="hidden" value="<custom value>">
        <input name="token" type="hidden" value="<token>">
        <input name="file" type="file">
        ...
      </form>
    

</code>
Copy after login
Copy after login

找到的原因竟然是 那个空间不支持 我又新建一个空间就可以 奇葩。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template