当前位置: 首页>>代码示例>>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;未经允许,请勿转载。