Пример #1
0
require_once LIB_DIR . 'config.php';
require_once LIB_DIR . 'helper.php';
require_once LIB_DIR . 'pdo.class.php';
require_once QBOX_SDK_DIR . 'rs.php';
require_once QBOX_SDK_DIR . 'fileop.php';
require_once QBOX_SDK_DIR . 'client/rs.php';
require_once QBOX_SDK_DIR . 'authtoken.php';
/**
 * 设置错误报告级别
 */
error_reporting($config['error']['reporting']);
/**
 * 初始化数据库连接句柄
 */
$db = Core_Db::getInstance($config["db"]);
/**
 * 配置七牛云存储密钥信息
 */
$QBOX_ACCESS_KEY = $config["qbox"]["access_key"];
$QBOX_SECRET_KEY = $config["qbox"]["secret_key"];
/**
 * 初始化 OAuth Client Transport
 */
$client = QBox_OAuth2_NewClient();
/**
 * 初始化 Qbox Reource Service Transport
 */
$bucket = $config["qbox"]["bucket"];
$rs = QBox_RS_NewService($client, $bucket);
$upToken = QBox_MakeAuthToken(array('expiresIn' => 3600));
Пример #2
0
#!/usr/bin/env php
<?php 
require_once 'authtoken.php';
$QBOX_ACCESS_KEY = '<Please apply your access key>';
$QBOX_SECRET_KEY = '<Dont send your secret key to anyone>';
$opts = array("scope" => "test_bucket", "expiresIn" => 3600, "callbackUrl" => "http://example.com/callback?a=b&d=c");
$upToken = QBox_MakeAuthToken($opts);
var_dump($upToken);