當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Qiniu_SetKeys函數代碼示例

本文整理匯總了PHP中Qiniu_SetKeys函數的典型用法代碼示例。如果您正苦於以下問題:PHP Qiniu_SetKeys函數的具體用法?PHP Qiniu_SetKeys怎麽用?PHP Qiniu_SetKeys使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Qiniu_SetKeys函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initSDK

 public static function initSDK($accesskey, $sercetkey)
 {
     // 調用 SDK 設置密鑰
     require_once 'sdk/io.php';
     require_once 'sdk/rs.php';
     Qiniu_SetKeys($accesskey, $sercetkey);
 }
開發者ID:bowu8,項目名稱:qiniu-file-for-typecho,代碼行數:7,代碼來源:Plugin.php

示例2: initKeys

function initKeys()
{
    global $accessKey, $secretKey;
    if (!empty($accessKey) && !empty($secretKey)) {
        Qiniu_SetKeys($accessKey, $secretKey);
    }
}
開發者ID:timelessmemory,項目名稱:uhkklp,代碼行數:7,代碼來源:bootstrap.php

示例3: deleteResByTopicIDArray

 private function deleteResByTopicIDArray($badTopicList)
 {
     if (empty($badTopicList)) {
         return true;
     }
     require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR . 'qiniu' . DIRECTORY_SEPARATOR . 'rs.php';
     if (!empty($badTopicList)) {
         foreach ($badTopicList as $key => $topic) {
             $resUrl = $topic['resUrl'];
             if (!empty($resUrl)) {
                 $qn = getQNFromUrl($resUrl);
                 Qiniu_SetKeys(JY_QN_accessKey, JY_QN_secretKey);
                 $client = new Qiniu_MacHttpClient(null);
                 $err = Qiniu_RS_Move($client, $qn['bucket'], $qn['key'], JY_QN_bucket_recycle, $qn['key']);
                 if ($err !== null && $err->Code != 612) {
                     $this->topic->insertBadTopic($topic['id'], $resUrl, $err->Code);
                     return false;
                 } else {
                     return true;
                 }
             }
         }
     }
     return true;
 }
開發者ID:jockchou,項目名稱:qingpaiAdmin,代碼行數:25,代碼來源:topic.php

示例4: save

 public function save($url, $config)
 {
     set_time_limit(0);
     if (empty($url)) {
         return '';
     }
     $ext = strrchr($url, ".");
     if ($ext != ".jpeg" && $ext != ".gif" && $ext != ".jpg" && $ext != ".png") {
         return "";
     }
     $filename = random(30) . $ext;
     if (!$this->check_remote_file_exists($url)) {
         return "";
     }
     $contents = @file_get_contents($url);
     $storename = $filename;
     $bu = $config['bucket'] . ":" . $storename;
     $accessKey = $config['access_key'];
     $secretKey = $config['secret_key'];
     Qiniu_SetKeys($accessKey, $secretKey);
     $putPolicy = new Qiniu_RS_PutPolicy($bu);
     $upToken = $putPolicy->Token(null);
     $putExtra = new Qiniu_PutExtra();
     $putExtra->Crc32 = 1;
     list($ret, $err) = Qiniu_Put($upToken, $storename, $contents, $putExtra);
     if (!empty($err)) {
         return "";
     }
     return 'http://' . trim($config['url']) . "/" . $ret['key'];
 }
開發者ID:noikiy,項目名稱:mygit,代碼行數:30,代碼來源:model.php

示例5: upload_qiniu

 public function upload_qiniu($file = "", $name = "")
 {
     $path = $_SERVER['DOCUMENT_ROOT'];
     require_once $path . "/app/libraries/qiniu/rs.php";
     require_once $path . "/app/libraries/qiniu/io.php";
     $bucket = "meilimei";
     $local_file = "upload/" . $name;
     $key = $local_file;
     $accessKey = 'tjtiZoMyJa9ggnNisrdocCCGvTlNLFvYxGMMQ6LF';
     $secretKey = '6zQXHont_jN-QFznn96H4oKA7IUqjibPeC-Yto62';
     Qiniu_SetKeys($accessKey, $secretKey);
     $putPolicy = new Qiniu_RS_PutPolicy($bucket);
     $upToken = $putPolicy->Token(null);
     if (move_uploaded_file($file, $local_file)) {
         $upload_file = $path . "/upload/" . $name;
         $putExtra = new Qiniu_PutExtra();
         $putExtra->Crc32 = 1;
         list($ret, $err) = Qiniu_PutFile($upToken, $key, $upload_file, $putExtra);
         if ($err !== null) {
             return false;
         } else {
             //var_dump($ret);
             return $ret;
         }
     } else {
         return false;
         // 			echo "move_uploaded錯誤!";
         // 			die;
     }
     return false;
 }
開發者ID:sexseses,項目名稱:meilimei_old_api,代碼行數:31,代碼來源:remote.php

示例6: __construct

 public function __construct($accessKey, $secretKey, $bucket)
 {
     $this->bucket = $bucket;
     require_once "qiniu/rs.php";
     Qiniu_SetKeys($accessKey, $secretKey);
     $putPolicy = new Qiniu_RS_PutPolicy($bucket);
     $this->putPolicy = $putPolicy;
 }
開發者ID:JX3PVE-Team,項目名稱:JX3PVE2015,代碼行數:8,代碼來源:qn.class.php

示例7: upload

 public function upload($key, $source)
 {
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $upToken = $putPolicy->Token(null);
     $putExtra = new Qiniu_PutExtra();
     $putExtra->Crc32 = 1;
     return Qiniu_PutFile($upToken, $key, $source, $putExtra);
 }
開發者ID:udeth,項目名稱:YOF,代碼行數:9,代碼來源:L_Qiniu.class.php

示例8: __construct

 public function __construct(ContainerInterface $container, $accessKey, $secretKey, $bucket, $domain)
 {
     $this->container = $container;
     $this->accessKey = $accessKey;
     $this->secretKey = $secretKey;
     $this->bucket = $bucket;
     $this->domain = $domain;
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $this->client = new \Qiniu_MacHttpClient(null);
 }
開發者ID:Doweidu,項目名稱:DWDQiniuSdkBundle,代碼行數:10,代碼來源:Qiniu.php

示例9: getToken

 /**
  * Get qiniu token
  * @param null $key
  * @return string qiniu token
  */
 public function getToken($key = null)
 {
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $scope = $this->bucket;
     if (!empty($key)) {
         // allowed to overwrite the file
         $scope .= ':' . $key;
     }
     $putPolicy = new \Qiniu_RS_PutPolicy($scope);
     $upToken = $putPolicy->Token(null);
     return $upToken;
 }
開發者ID:timelessmemory,項目名稱:uhkklp,代碼行數:17,代碼來源:Qiniu.php

示例10: getSign

 /**
  * 設置路徑
  * @param $key
  * @param null $returnUrl
  * @param null $returnBody
  * @return string
  */
 public function getSign($preKey = '', $returnUrl = null, $returnBody = null)
 {
     Qiniu_SetKeys(Yii::app()->params['QINIU_ACCESS_KEY'], Yii::app()->params['QINIU_SECRET_KEY']);
     $putPolicy = new Qiniu_RS_PutPolicy(Yii::app()->params['QINIU_BUCKET']);
     $putPolicy->Expires = 60 * 30;
     $putPolicy->SaveKey = $preKey . '$(etag)';
     $putPolicy->MimeLimit = 'image/*';
     if ($returnUrl !== null) {
         $putPolicy->CallbackUrl = $returnUrl;
     }
     if ($returnBody !== null) {
         $putPolicy->CallbackBody = urldecode(http_build_query($returnBody));
     }
     $upToken = $putPolicy->Token(null);
     return $upToken;
 }
開發者ID:daysun1987,項目名稱:daydaynews,代碼行數:23,代碼來源:Qiniu.php

示例11: qiniu

 function qiniu()
 {
     echo 'qiniu';
     $bucket = "xappqiniu";
     $key = "apartment_1.jpg";
     $accessKey = 'f9zK0PZeWtFNGY5lxrXeOM6MphG2xxNYBuXv6fGn';
     $secretKey = 'PFSvanHSINAYXoW_-PBTUUNpkA7IU-w7q3pQ1JNj';
     Qiniu_SetKeys($accessKey, $secretKey);
     $client = new Qiniu_MacHttpClient(null);
     list($ret, $err) = Qiniu_RS_Stat($client, $bucket, $key);
     echo "Qiniu_RS_Stat result: \n";
     if ($err !== null) {
         var_dump($err);
     } else {
         var_dump($ret);
     }
 }
開發者ID:iHamburg,項目名稱:kqserver,代碼行數:17,代碼來源:testqiniu.php

示例12: __construct

 function __construct($params)
 {
     /** 實例化*/
     $this->ci =& get_instance();
     require_once "qiniu/io.php";
     require_once "qiniu/rs.php";
     //
     $this->accessKey = $params['accesskey'];
     $this->secretKey = $params['secretkey'];
     $this->bucket = $params['bucket'];
     $this->file_domain = $params['file_domain'];
     $key = 'test.png';
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $this->upToken = $putPolicy->Token(null);
     $this->putExtra = new Qiniu_PutExtra();
     $this->putExtra->Crc32 = 1;
 }
開發者ID:stoneStyle,項目名稱:startbbs,代碼行數:18,代碼來源:Qiniu_lib.php

示例13: doMobileUpload

 public function doMobileUpload()
 {
     require_once "qiniu.config.php";
     global $_GPC;
     $serverId = $_GPC['serverId'];
     //獲取音頻鏈接
     $fileName = substr($serverId, -10) . '.amr';
     $url = 'http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=' . $this->jssdk->getAccessToken() . '&media_id=' . $serverId;
     $body = $this->jssdk->HttpGet($url);
     // 上傳至七牛
     Qiniu_SetKeys($qiniu['accessKey'], $qiniu['secretKey']);
     $putPolicy = new Qiniu_RS_PutPolicy($qiniu['bucket']);
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_Put($upToken, $fileName, $body, null);
     if ($err !== null) {
         var_dump($err);
     } else {
         // var_dump($ret);
         echo 'http://' . $qiniu['domainName'] . '/' . $fileName;
     }
 }
開發者ID:eduNeusoft,項目名稱:weixin,代碼行數:21,代碼來源:site.php

示例14: getImageView

 public function getImageView($mode = 0, $width = '', $height = '', $format = '', $interlace = '')
 {
     require_once LIBPATH . 'Qiniu/rs.php';
     require_once LIBPATH . 'Qiniu/fop.php';
     $domain = $this->bucket . '.qiniudn.com';
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     //生成baseUrl
     $baseUrl = Qiniu_RS_MakeBaseUrl($domain, $filename);
     //生成fopUrl
     $imgView = new Qiniu_ImageView();
     $imgView->Mode = $mode;
     $imgView->Width = $width;
     $imgView->Height = $height;
     $imgView->Format = $format;
     $imgView->Interlace = $interlace;
     $imgViewUrl = $imgView->MakeRequest();
     //對fopUrl 進行簽名,生成privateUrl。 公有bucket 此步可以省去。
     // $getPolicy = new Qiniu_RS_GetPolicy();
     // return $getPolicy->MakeRequest($imgViewUrl, null);
     return $imgViewUrl;
 }
開發者ID:zuozuoba,項目名稱:zpf,代碼行數:21,代碼來源:QiNiu.php

示例15: uploadFile

 /**
  * 文件上傳
  * @param string $filePath 待上傳文件的絕對路徑
  * @return string 上傳成功後的URL,失敗時返回空
  */
 public function uploadFile($filePath)
 {
     $fileUrl = '';
     if (!file_exists($filePath)) {
         return $fileUrl;
     }
     $config = $this->config;
     $fileName = date('YmdHis_', $_SERVER['REQUEST_TIME']) . md5(PhalApi_Tool::createRandStr(8) . microtime(true));
     Qiniu_SetKeys($config['accessKey'], $config['secretKey']);
     $putPolicy = new Qiniu_RS_PutPolicy($config['space_bucket']);
     $upToken = $putPolicy->Token(null);
     $putExtra = new Qiniu_PutExtra();
     $putExtra->Crc32 = 1;
     list($ret, $err) = Qiniu_PutFile($upToken, $fileName, $filePath, $putExtra);
     if ($err !== null) {
         DI()->logger->debug('failed to upload file to qiniu', array('Err' => $err->Err, 'Reqid' => $err->Reqid, 'Details' => $err->Details, 'Code' => $err->Code));
     } else {
         $fileUrl = $config['space_host'] . '/' . $fileName;
         DI()->logger->debug('succeed to upload file to qiniu', $ret);
     }
     return $fileUrl;
 }
開發者ID:WJayWJay,項目名稱:phalapi-library,代碼行數:27,代碼來源:Lite.php


注:本文中的Qiniu_SetKeys函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。