Home > Backend Development > PHP Tutorial > 各位大牛谁知道怎么用php 生成token 七牛云存储

各位大牛谁知道怎么用php 生成token 七牛云存储

WBOY
Release: 2016-06-06 20:24:19
Original
1856 people have browsed it

我需要用php生成 七牛规则中的token,不知道该怎么生成,请问具体方法。

回复内容:

我需要用php生成 七牛规则中的token,不知道该怎么生成,请问具体方法。

<code>$data['scope']='你的bucket';
$data['deadline']=time()+3600;
$encoded=urlsafe_base64_encode(json_encode($data));
$signature=hash_hmac('sha1',$encoded,'KEY',true);
$encode_signed = urlsafe_base64_encode($signature);
$UploadToken='AK:'.$encode_signed.':'.$encoded;
  
echo $UploadToken;</code>
Copy after login

SDK有现成的,
$token = $auth->uploadToken($bucket);

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