Skip to content

Commit a65ca98

Browse files
committed
新方法
1 parent 04e8d02 commit a65ca98

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ to the require section of your composer.json.
2222
使用方式
2323
------------
2424
```
25-
$client = new \aliyun\live\Client('123456', '123456');
25+
$client = new \aliyun\live\Client([
26+
'accessKeyId' => '123456',
27+
'accessSecret' => '123456'
28+
]);
2629
$package = [
2730
'Action' => 'DescribeLiveStreamsPublishList',
2831
'DomainName' => 'live.cctv.com',

src/Client.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,29 @@ class Client
4040
*/
4141
public $signer;
4242

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+
5444

5545
/**
5646
* @var \GuzzleHttp\Client
5747
*/
5848
public $_httpClient;
5949

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+
6066
/**
6167
* 获取Http Client
6268
* @return \GuzzleHttp\Client

0 commit comments

Comments
 (0)