Skip to content

Commit 147b15f

Browse files
author
liguimin
committed
update
2 parents 7657ba7 + 5b092a3 commit 147b15f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
安装
2+
-----
3+
composer require lobtao/tp5helper
4+
15
Curl.php 使用示例
26
-----
37

@@ -13,12 +17,12 @@ if ($curl->errorCode === null) {
1317
} else {
1418
// List of curl error codes here https://curl.haxx.se/libcurl/c/libcurl-errors.html
1519
switch ($curl->errorCode) {
16-
20+
1721
case 6:
1822
//host unknown example
1923
break;
2024
}
21-
}
25+
}
2226
```
2327

2428
```php
@@ -34,7 +38,7 @@ $response = $curl->setGetParams([
3438

3539

3640
```php
37-
// POST URL form-urlencoded
41+
// POST URL form-urlencoded
3842
$curl = new Curl();
3943
$response = $curl->setPostParams([
4044
'key' => 'value',
@@ -86,14 +90,14 @@ $params = [
8690
$response = $curl->setRequestBody(json_encode($params))
8791
->setOption(CURLOPT_ENCODING, 'gzip')
8892
->post('http://example.com/');
89-
93+
9094
// List of status codes here http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
9195
switch ($curl->responseCode) {
9296

9397
case 'timeout':
9498
//timeout error logic here
9599
break;
96-
100+
97101
case 200:
98102
//success logic here
99103
break;
@@ -121,7 +125,7 @@ use think\Session;
121125
class ServiceController extends RpcController {
122126

123127
function index() {
124-
$this->handle('app\\service\\', function ($func, $params) {
128+
return $this->handle('app\\service\\', function ($func, $params) {
125129
if (in_array(strtolower($func), ['user_login', 'user_logout'])) //登录方法不判断
126130
return;
127131

0 commit comments

Comments
 (0)