本文整理汇总了PHP中Qiniu_Encode函数的典型用法代码示例。如果您正苦于以下问题:PHP Qiniu_Encode函数的具体用法?PHP Qiniu_Encode怎么用?PHP Qiniu_Encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Qiniu_Encode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEncode
public function testEncode()
{
$cases = array('abc' => 'YWJj', 'abc0=?e' => 'YWJjMD0_ZQ==');
foreach ($cases as $k => $v) {
$v1 = Qiniu_Encode($k);
$this->assertEquals($v, $v1);
}
}
示例2: Qiniu_Sign
function Qiniu_Sign($url)
{
//$info里面的url
$setting = C('UPLOAD_SITEIMG_QINIU');
$duetime = NOW_TIME + 86400;
//下载凭证有效时间
$DownloadUrl = $url . '?e=' . $duetime;
$Sign = hash_hmac('sha1', $DownloadUrl, $setting["driverConfig"]["secrectKey"], true);
$EncodedSign = Qiniu_Encode($Sign);
$Token = $setting["driverConfig"]["accessKey"] . ':' . $EncodedSign;
$RealDownloadUrl = $DownloadUrl . '&token=' . $Token;
return $RealDownloadUrl;
}
示例3: Qiniu_Rio_Mkfile
function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra)
{
$entry = $extra->Bucket . ':' . $key;
$url = $host . '/rs-mkfile/' . Qiniu_Encode($entry) . '/fsize/' . $fsize;
if (!empty($extra->MimeType)) {
$url .= '/mimeType/' . Qiniu_Encode($extra->MimeType);
}
$ctxs = array();
foreach ($extra->Progresses as $prog) {
$ctxs[] = $prog['ctx'];
}
$body = implode(',', $ctxs);
return Qiniu_Client_CallWithForm($self, $url, $body, 'text/plain');
}
示例4: Qiniu_Rio_Mkfile
function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra)
{
$url = $host . '/mkfile/' . $fsize;
if ($key !== null) {
$url .= '/key/' . Qiniu_Encode($key);
}
if (!empty($extra->MimeType)) {
$url .= '/mimeType/' . Qiniu_Encode($extra->MimeType);
}
$ctxs = array();
foreach ($extra->Progresses as $prog) {
$ctxs[] = $prog['ctx'];
}
$body = implode(',', $ctxs);
return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream');
}
示例5: SignWithData
public function SignWithData($data)
{
$data = Qiniu_Encode($data);
return $this->Sign($data) . ':' . $data;
}
示例6: MakeRequest
public function MakeRequest($url = '')
{
$ops = array($this->Mode);
if (!empty($this->Text)) {
$ops[] = 'text/' . Qiniu_Encode($this->Text);
}
if (!empty($this->Font)) {
$ops[] = 'font/' . Qiniu_Encode($this->Font);
}
if (!empty($this->FontSize)) {
$ops[] = 'fontsize/' . $this->FontSize;
}
if (!empty($this->Fill)) {
$ops[] = 'fill/' . Qiniu_Encode($this->Fill);
}
if (!empty($this->Disslove)) {
$ops[] = 'dissolve/' . $this->Disslove;
}
if (!empty($this->Gravity)) {
$ops[] = 'gravity/' . $this->Gravity;
}
if (!empty($this->Dx)) {
$ops[] = 'dx/' . $this->Dx;
}
if (!empty($this->Dy)) {
$ops[] = 'dy/' . $this->Dy;
}
return $url . 'watermark/' . implode('/', $ops);
}
示例7: Qiniu_RS_URIMove
function Qiniu_RS_URIMove($bucketSrc, $keySrc, $bucketDest, $keyDest)
{
return '/move/' . Qiniu_Encode("{$bucketSrc}:{$keySrc}") . '/' . Qiniu_Encode("{$bucketDest}:{$keyDest}");
}
示例8: Qiniu_accessToken
/**
* generate_access_token
* @desc 生成 AccessToken
* @param string $url
* @param string $body
* @return string
*/
function Qiniu_accessToken($url, $body)
{
$setting = C('UPLOAD_SITEIMG_QINIU');
$access_key = $setting["driverConfig"]["accessKey"];
$secret_key = $setting["driverConfig"]["secrectKey"];
$parsed_url = parse_url($url);
$path = $parsed_url['path'];
$access = $path;
if (isset($parsed_url['query'])) {
$access .= "?" . $parsed_url['query'];
}
$access .= "\n";
if ($body) {
$access .= $body;
}
$digest = hash_hmac('sha1', $access, $secret_key, true);
return $access_key . ':' . Qiniu_Encode($digest);
}
示例9: Qiniu_Encode
<?php
require_once "../../qiniu/http.php";
require_once "../../qiniu/auth_digest.php";
require_once "../../qiniu/utils.php";
$accessKey = "";
$secretKey = "";
$bucket = "";
$key = "";
$entry = "{$bucket}:{$key}";
$encodedEntry = Qiniu_Encode($entry);
$apiHost = "http://iovip.qbox.me";
$apiPath = "/prefetch/{$encodedEntry}";
$requestBody = "";
$mac = new Qiniu_Mac($accessKey, $secretKey);
$client = new Qiniu_MacHttpClient($mac);
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
if ($err !== null) {
echo "failed\n";
var_dump($err);
} else {
echo "success\n";
}
示例10: header
<?php
header("Content-Type:application/json");
require_once "../../lib/qiniu/rs.php";
require_once "../../lib/qiniu/utils.php";
require_once "../../qiniu_config.php";
Qiniu_SetKeys($Qiniu_AccessKey, $Qiniu_SecretKey);
$putPolicy = new Qiniu_RS_PutPolicy($Qiniu_Public_Bucket);
$saveBucket = $Qiniu_Public_Bucket;
$saveKey = "test_2.mp4";
//转码指令
$putPolicy->PersistentOps = "avthumb/mp4|saveas/" + Qiniu_Encode($saveBucket + ":" + $saveKey);
//转码队列
$putPolicy->PersistentPipeline = "jemy";
//转码结果通知地址
$putPolicy->PersistentNotifyUrl = "http://www.abc.com/fake/notifyURL";
$token = $putPolicy->Token(null);
$respData = array("uptoken" => $token);
$respBody = json_encode($respData);
echo $respBody;
示例11: getZipInfo
public static function getZipInfo($fileList = array(), $saveas = '')
{
require_once __DIR__ . '/../qiniu/http.php';
require_once __DIR__ . '/../qiniu/auth_digest.php';
require_once __DIR__ . '/../qiniu/utils.php';
$fops = 'mkzip/2';
$extraKey = null;
// var_export($fileList);
foreach ($fileList as $key => $value) {
if (preg_match('/^http:\\/\\//', $value)) {
if (is_int($key)) {
$fops .= '/url/' . Qiniu_Encode($value);
} else {
$fops .= '/url/' . Qiniu_Encode($value);
// $fops .= '/alias/'.Qiniu_Encode($key);
// var_export($key);
// var_export(Qiniu_Encode($key));
$fops .= '/alias/' . Qiniu_Encode($key);
}
if ($extraKey == null) {
$extraKey = $value;
}
}
}
if ($saveas == null) {
$saveas = md5($fops) . '.zip';
}
if ($saveas != null) {
$fops .= '|saveas/' . Qiniu_Encode(W2Config::$Qiniu_bucket . ':' . $saveas);
}
$persistentKey = 'mkzip.' . $saveas . '.pfop';
$saveFileInfo = W2Qiniu::getFileInfoFromQiniu($saveas);
if (is_array($saveFileInfo) && array_key_exists('fsize', $saveFileInfo)) {
return $saveFileInfo;
}
$persistentId = W2Qiniu::getKeyContent($persistentKey);
if (!is_null($persistentId)) {
return W2Qiniu::getPersistentInfo($persistentId);
}
if (strpos($extraKey, W2Config::$Qiniu_domain) != false) {
$extraKey = str_replace('http://' . W2Config::$Qiniu_domain . '/', '', $extraKey);
}
$notifyURL = "";
$force = 0;
$encodedBucket = urlencode(W2Config::$Qiniu_bucket);
$encodedKey = urlencode($extraKey);
$encodedFops = urlencode($fops);
$encodedNotifyURL = urlencode($notifyURL);
$apiHost = "http://api.qiniu.com";
$apiPath = "/pfop/";
$requestBody = "bucket={$encodedBucket}&key={$encodedKey}&fops={$encodedFops}¬ifyURL={$encodedNotifyURL}";
if ($force !== 0) {
$requestBody .= "&force=1";
}
$mac = new Qiniu_Mac(W2Config::$Qiniu_accessKey, W2Config::$Qiniu_secretKey);
$client = new Qiniu_MacHttpClient($mac);
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
if ($err !== null) {
var_dump($err);
} else {
if (is_array($ret) && array_key_exists('persistentId', $ret)) {
W2Qiniu::setKeyContent($persistentKey, $ret['persistentId']);
return W2Qiniu::getPersistentInfo($ret['persistentId']);
}
return $ret;
}
}
示例12: Qiniu_Encode
$destEntry = "{$destBucket}:{$destKey}";
$encodedEntry = Qiniu_Encode($destEntry);
$apiHost = "http://iovip.qbox.me";
$apiPath = "/fetch/{$encodedUrl}/to/{$encodedEntry}";
$requestBody = "";
$mac = new Qiniu_Mac($accessKey, $secretKey);
$client = new Qiniu_MacHttpClient($mac);
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
if ($err !== null) {
echo "failed\n";
var_dump($err);
} else {
$bucket = $destBucket;
$key = $destKey;
Qiniu_SetKeys($accessKey, $secretKey);
$entry = Qiniu_Encode($_POST['name'] . ':' . $_POST['title'] . $times . '.mp3');
$url = "avthumb/mp3|saveas/{$entry}";
$fops = $url;
$notifyURL = "";
$force = 0;
$encodedBucket = urlencode($bucket);
$encodedKey = urlencode($key);
$encodedFops = urlencode($fops);
$encodedNotifyURL = urlencode($notifyURL);
$apiHost = "http://api.qiniu.com";
$apiPath = "/pfop/";
$requestBody = "bucket={$encodedBucket}&key={$encodedKey}&fops={$encodedFops}¬ifyURL={$encodedNotifyURL}";
if ($force !== 0) {
$requestBody .= "&force=1";
}
$mac = new Qiniu_Mac($accessKey, $secretKey);
示例13: Qiniu_Encode
<?php
require_once "../../qiniu/http.php";
require_once "../../qiniu/auth_digest.php";
require_once "../../qiniu/utils.php";
$accessKey = "";
$secretKey = "";
$targetUrl = "";
$destBucket = "";
$destKey = "";
$encodedUrl = Qiniu_Encode($targetUrl);
$destEntry = "{$destBucket}:{$destKey}";
$encodedEntry = Qiniu_Encode($destEntry);
$apiHost = "http://iovip.qbox.me";
$apiPath = "/fetch/{$encodedUrl}/to/{$encodedEntry}";
$requestBody = "";
$mac = new Qiniu_Mac($accessKey, $secretKey);
$client = new Qiniu_MacHttpClient($mac);
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
if ($err !== null) {
echo "failed\n";
var_dump($err);
} else {
echo "success\n";
}
示例14: date
$pfop->Key = $nfilename;
if ($audiotype == 'music') {
$nfilenamefop = 'FMFOPM' . date('YmdHis') . random(16) . '.mp3';
$savedKey = $nfilenamefop;
$entry = Qiniu_Encode("{$pfop->Bucket}:{$savedKey}");
$pfop->Fops = "avthumb/mp3/aq/{$aq}/ar/44100|saveas/{$entry}";
} elseif ($audiotype == 'voice') {
$nfilenamefop = 'FMVOICEFOPM' . date('YmdHis') . random(16) . '.mp3';
$savedKey = $nfilenamefop;
$entry = Qiniu_Encode("{$pfop->Bucket}:{$savedKey}");
$pfop->Fops = "avthumb/mp3/aq/{$aq}/ar/44100|saveas/{$entry}";
} elseif ($audiotype == 'vedio') {
$nfilenamefop = 'FMFOPV' . date('YmdHis') . random(16) . '.mp4';
$savedKey = $nfilenamefop;
$entry = Qiniu_Encode("{$pfop->Bucket}:{$savedKey}");
$image = Qiniu_Encode("{$videologo}");
$pfop->Fops = "avthumb/mp4/wmImage/{$image}/wmGravity/{$wmgravity}/vcodec/libx264/s/{$videofbl}/rotate/auto|saveas/{$entry}";
}
if ($pipeline) {
$pfop->Pipeline = $pipeline;
}
list($ret, $err) = $pfop->MakeRequest($client);
//$pfop->Force = 1;
//echo "\n\n====> pfop result: \n";
if ($err !== null) {
//var_dump($err);
$fmdata = array("success" => -1, "msg" => $err);
//echo json_encode($fmdata);
echo json_encode($fmdata);
exit;
} else {
示例15: Qiniu_RS_Fetch
function Qiniu_RS_Fetch($self, $url, $bucket, $key)
{
global $QINIU_IOVIP_HOST;
$path = '/fetch/' . Qiniu_Encode($url) . '/to/' . Qiniu_Encode("{$bucket}:{$key}");
return Qiniu_Client_CallNoRet($self, $QINIU_IOVIP_HOST . $path);
}