Home > Backend Development > PHP Tutorial > 七牛云存储 - 七牛php-sdk回调问题

七牛云存储 - 七牛php-sdk回调问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:35:11
Original
1462 people have browsed it

<code><?php require_once($_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php');

use Qiniu\Auth;

$accessKey = '9A2bjCYNsd1yYL6EMUD5fcIfEMoRj4H2OvgBwmjo';
$secretKey = 'lXCCmDAPpMOqvP-8Uj1jA-bwKLa2XH_007IfBWOa';
$auth = new Auth($accessKey, $secretKey);

$bucket = 'usa-cns';
// 设置put policy的其他参数
$opts = array(
    'callbackUrl' => 'http://songcharm.com/back',
    'callbackBody' => 'name=$(fname)&hash=$(etag)'
);
$token = $auth->uploadToken($bucket, null, 3600, $opts);
?>
</code>
Copy after login
Copy after login

这样的回调写法对吗?为什么我提交了上传表单,返回的还是upload.qiniu.com这个地址呢

回复内容:

<code><?php require_once($_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php');

use Qiniu\Auth;

$accessKey = '9A2bjCYNsd1yYL6EMUD5fcIfEMoRj4H2OvgBwmjo';
$secretKey = 'lXCCmDAPpMOqvP-8Uj1jA-bwKLa2XH_007IfBWOa';
$auth = new Auth($accessKey, $secretKey);

$bucket = 'usa-cns';
// 设置put policy的其他参数
$opts = array(
    'callbackUrl' => 'http://songcharm.com/back',
    'callbackBody' => 'name=$(fname)&hash=$(etag)'
);
$token = $auth->uploadToken($bucket, null, 3600, $opts);
?>
</code>
Copy after login
Copy after login

这样的回调写法对吗?为什么我提交了上传表单,返回的还是upload.qiniu.com这个地址呢

这个回调的写法是正确的,你指的返回的是upload.qiniu.com地址具体是什么意思,设置了回调,七牛会post给 http://songcharm.com/back 这个url,上传文件的原始文件名(fname)和文件的hash(etag)值,你可以看下服务端是否接收到了七牛的回调。

Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template