您好,欢迎访问一九零五行业门户网

为阿里云存储开发的PHP PEAR 包:Services

阿里云开放存储服务 oss:用于存储图片、apk等静态资源,使用阿里云带宽,不占用开发者服务器带宽。 阿里云官方php sdk: http://aliyun.com/product/oss/#help 对于这种第三方库,php官方称之为pear,需要按照pear标准开发(标准uri)。 pear的优势:一键安
阿里云开放存储服务 oss:用于存储图片、apk等静态资源,使用阿里云带宽,不占用开发者服务器带宽。
阿里云官方php sdk:
http://aliyun.com/product/oss/#help
对于这种第三方库,php官方称之为pear,需要按照pear标准开发(标准uri)。
pear的优势:一键安装到php/lib/php目录,require即可使用,很方便。
由于阿里云官方php sdk没按照pear标准开发,使用不方便,所以我开发了一个,安装步骤如下:
pear channel-discover sinkcup.github.io/pearpear install sinkcup/httppear install sinkcup/services_aliyun_oss
使用步骤:
1、到阿里云注册一个帐号,开通oss,创建一个bucket空间。
2、demo(参考https://github.com/sinkcup/services_aliyun_oss/blob/0.0.1/tests/services/aliyun/osstest.php):
php require services/aliyun/oss.php;$conf = array( 'accesskeyid' => 'foo', 'accesskeysecret' => 'bar',); $c = new services_aliyun_oss('com-example-dl', $conf);$headers = array( 'content-type' => 'image/jpeg',);$r = $c->put('/home/u1/2.jpg', '/2.jpg', $headers );var_dump($r);$this->assertarrayhaskey('internet', $r);?>
项目代码:https://github.com/sinkcup/services_aliyun_oss
pear频道:http://sinkcup.github.io/pear/
其它类似信息

推荐信息