File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ to the require section of your composer.json.
22
22
使用方式
23
23
------------
24
24
```
25
- $client = new \aliyun\live\Client('123456', '123456');
25
+ $client = new \aliyun\live\Client([
26
+ 'accessKeyId' => '123456',
27
+ 'accessSecret' => '123456'
28
+ ]);
26
29
$package = [
27
30
'Action' => 'DescribeLiveStreamsPublishList',
28
31
'DomainName' => 'live.cctv.com',
Original file line number Diff line number Diff line change @@ -40,23 +40,29 @@ class Client
40
40
*/
41
41
public $ signer ;
42
42
43
- /**
44
- * Client constructor.
45
- * @param string $accessKeyId
46
- * @param string $accessSecret
47
- */
48
- public function __construct ($ accessKeyId , $ accessSecret )
49
- {
50
- $ this ->accessKeyId = $ accessKeyId ;
51
- $ this ->accessSecret = $ accessSecret ;
52
- $ this ->signer = new ShaHmac1Signer ();
53
- }
43
+
54
44
55
45
/**
56
46
* @var \GuzzleHttp\Client
57
47
*/
58
48
public $ _httpClient ;
59
49
50
+ /**
51
+ * Request constructor.
52
+ * @param array $config
53
+ */
54
+ public function __construct ($ config = [])
55
+ {
56
+ foreach ($ config as $ name => $ value ) {
57
+ $ this ->{$ name } = $ value ;
58
+ }
59
+ $ this ->init ();
60
+ }
61
+
62
+ public function init (){
63
+ $ this ->signer = new ShaHmac1Signer ();
64
+ }
65
+
60
66
/**
61
67
* 获取Http Client
62
68
* @return \GuzzleHttp\Client
You can’t perform that action at this time.
0 commit comments