照做绝对行,在ThinkPHP中,第三方库都放在ThinkPHP/Library/Vendor/路径下。
1.下载OSS PHP SDK:https://help.aliyun.com/document_detail/oss/sdk/php-sdk/install.html
2.在ThinkPHP/Library/Vendor/下建立一个OSS目录,将解压后的SDK拷贝到这个目录:
在ThinkPHP中的的 ThinkPHP/Library/Vendor/OSS/ 目录下adk文件与目录:
samples
src
tests
.coveralls.yml
.gitignore
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
autoload.php
composer.json
........
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
public function edit(){ Vendor( 'OSS.autoload' ); //引入文件 $accessKeyId = "" ; $accessKeySecret = "" ; $endpoint = "" ; try { $ossClient = new OSSOssClient( $accessKeyId , $accessKeySecret , $endpoint ); } catch (OssException $e ) { print $e ->getMessage(); } var_dump( $ossClient ); } |