File tree Expand file tree Collapse file tree 5 files changed +44
-5
lines changed Expand file tree Collapse file tree 5 files changed +44
-5
lines changed Original file line number Diff line number Diff line change 11cos-php-sdk-v5 Upgrade Guide
22====================
3+ 2.1.5 to 2.1.6
4+ ----------
5+ - Add ` allow_redirects ` parameter
6+ - Fix ` selectObjectContent ` interface
7+
382.1.3 to 2.1.5
49----------
510- The ` download ` interface supports breakpoint
Original file line number Diff line number Diff line change 1919 'proxy ' => '' , //代理服务器
2020 'retry ' => 10 , //重试次数
2121 'userAgent ' => '' , //UA
22+ 'allow_redirects ' => false , //是否follow302
2223 'credentials ' => array (
2324 'secretId ' => $ secretId ,
2425 'secretKey ' => $ secretKey ,
Original file line number Diff line number Diff line change 5252 // 请求失败
5353 echo ($ e );
5454}
55+
56+ try {
57+ $ result = $ cosClient ->selectObjectContent (array (
58+ 'Bucket ' => $ bucket , //格式:BucketName-APPID
59+ 'Key ' => $ key ,
60+ 'Expression ' => 'Select * from COSObject s ' ,
61+ 'ExpressionType ' => 'SQL ' ,
62+ 'InputSerialization ' => array (
63+ 'CompressionType ' => 'None ' ,
64+ 'JSON ' => array (
65+ 'Type ' => 'DOCUMENT '
66+ )
67+ ),
68+ 'OutputSerialization ' => array (
69+ 'JSON ' => array (
70+ 'RecordDelimiter ' => '\n ' ,
71+ )
72+ ),
73+ 'RequestProgress ' => array (
74+ 'Enabled ' => 'FALSE '
75+ )
76+ ));
77+ // 请求成功
78+ foreach ($ result ['Data ' ] as $ data ) {
79+ // 迭代遍历select结果
80+ print_r ($ data );
81+ }
82+ } catch (\Exception $ e ) {
83+ // 请求失败
84+ echo ($ e );
85+ }
Original file line number Diff line number Diff line change 7777 * @method object GetBucketIntelligentTiering (array $arg)
7878 */
7979class Client extends GuzzleClient {
80- const VERSION = '2.1.5 ' ;
80+ const VERSION = '2.1.6 ' ;
8181
8282 public $ httpClient ;
8383
@@ -108,6 +108,7 @@ public function __construct($cosConfig) {
108108 $ this ->cosConfig ['retry ' ] = isset ($ cosConfig ['retry ' ]) ? $ cosConfig ['retry ' ] : 1 ;
109109 $ this ->cosConfig ['userAgent ' ] = isset ($ cosConfig ['userAgent ' ]) ? $ cosConfig ['userAgent ' ] : 'cos-php-sdk-v5. ' . Client::VERSION ;
110110 $ this ->cosConfig ['pathStyle ' ] = isset ($ cosConfig ['pathStyle ' ]) ? $ cosConfig ['pathStyle ' ] : false ;
111+ $ this ->cosConfig ['allow_redirects ' ] = isset ($ cosConfig ['allow_redirects ' ]) ? $ cosConfig ['allow_redirects ' ] : false ;
111112
112113 $ service = Service::getService ();
113114 $ handler = HandlerStack::create ();
@@ -130,6 +131,7 @@ public function __construct($cosConfig) {
130131 'timeout ' => $ this ->cosConfig ['timeout ' ],
131132 'handler ' => $ handler ,
132133 'proxy ' => $ this ->cosConfig ['proxy ' ],
134+ 'allow_redirects ' => $ this ->cosConfig ['allow_redirects ' ]
133135 ]);
134136 $ this ->desc = new Description ($ service );
135137 $ this ->api = (array )($ this ->desc ->getOperations ());
Original file line number Diff line number Diff line change @@ -2718,8 +2718,8 @@ public static function getService() {
27182718 )
27192719 ),
27202720 'JSON ' => array (
2721- 'type ' => 'string ' ,
2722- 'location ' => 'object ' ,
2721+ 'type ' => 'object ' ,
2722+ 'location ' => 'xml ' ,
27232723 'properties ' => array (
27242724 'Type ' => array (
27252725 'type ' => 'string ' ,
@@ -2764,8 +2764,8 @@ public static function getService() {
27642764 )
27652765 ),
27662766 'JSON ' => array (
2767- 'type ' => 'string ' ,
2768- 'location ' => 'object ' ,
2767+ 'type ' => 'object ' ,
2768+ 'location ' => 'xml ' ,
27692769 'properties ' => array (
27702770 'RecordDelimiter ' => array (
27712771 'type ' => 'string ' ,
You can’t perform that action at this time.
0 commit comments