Detailed introduction to how thinkPHP simply imports and uses Alibaba Cloud OSSsdk

黄舟
Release: 2023-03-06 17:12:01
Original
2095 people have browsed it

This article mainly introduces how thinkPHP simply imports and uses Alibaba Cloud OSSsdk. It briefly explains the PHP sdk download address of Alibaba Cloud OSS and how thinkPHP imports and uses OSSsdk. Friends who need it can refer to it

The example in this article describes how thinkPHP simply imports and uses Alibaba Cloud OSSsdk. Share it with everyone for your reference. The details are as follows:

It is absolutely ok to follow this. In ThinkPHP, third-party libraries are placed under the ThinkPHP/Library/Vendor/ path.

1. Download OSS PHP SDK: https://help.aliyun.com/document_detail/oss/sdk/php-sdk/install.html

2. In ThinkPHP/Library/Vendor Create an OSS directory under / and copy the decompressed SDK to this directory:

Adk files and directories under the ThinkPHP/Library/Vendor/OSS/ directory in ThinkPHP:

samples
src
tests
.coveralls.yml
.gitignore
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
autoload.php
composer.json
.....


##

public function edit(){
 Vendor('OSS.autoload');//引入文件
 $accessKeyId = ""; 
 $accessKeySecret = "";
 $endpoint = "";
 try {
  $ossClient = new \OSS\OssClient($accessKeyId, $accessKeySecret, $endpoint);
 } catch (OssException $e) {
  print $e->getMessage();
 }
 var_dump($ossClient);
}
Copy after login

The above is the detailed content of Detailed introduction to how thinkPHP simply imports and uses Alibaba Cloud OSSsdk. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!