
这是官方给的目录,我本地原生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); 最佳答案