TP3.2怎么引入百度云的SDK

浏览:1017 发布日期:2018/01/12 分类:求助交流 关键字: 百度云
TP3.2怎么引入百度云的SDK

这是官方给的目录,我本地原生PHP已经测试好了,一切正常,请问怎么集成到TP上呢,本地代码如下:<?php
include 'BaiduBce.phar'; 

use BaiduBce\BceClientConfigOptions;
use BaiduBce\Util\Time;
use BaiduBce\Util\MimeTypes;
use BaiduBce\Http\HttpHeaders;
use BaiduBce\Services\Bos\BosClient;
 
$BOS_TEST_CONFIG =
    array(
        'credentials' => array(
            'accessKeyId' => '111111111',
            'secretAccessKey' => '222222222', 
        ), 
    ); 
//新建BosClient
$client = new BosClient($BOS_TEST_CONFIG);
$bucketName = 'test';
$objectKey = '2/222.png';//上传后的文件名
$fileName = '1.png';//本地文件名

$res = $client->putObjectFromFile($bucketName, $objectKey, $fileName);

var_dump($res);
最佳答案
评论( 相关
后面还有条评论,点击查看>>