Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liguimin committed Sep 10, 2020
2 parents 7657ba7 + 5b092a3 commit 147b15f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
安装
-----
composer require lobtao/tp5helper

Curl.php 使用示例
-----

Expand All @@ -13,12 +17,12 @@ if ($curl->errorCode === null) {
} else {
// List of curl error codes here https://curl.haxx.se/libcurl/c/libcurl-errors.html
switch ($curl->errorCode) {

case 6:
//host unknown example
break;
}
}
}
```

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


```php
// POST URL form-urlencoded
// POST URL form-urlencoded
$curl = new Curl();
$response = $curl->setPostParams([
'key' => 'value',
Expand Down Expand Up @@ -86,14 +90,14 @@ $params = [
$response = $curl->setRequestBody(json_encode($params))
->setOption(CURLOPT_ENCODING, 'gzip')
->post('http://example.com/');

// List of status codes here http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
switch ($curl->responseCode) {

case 'timeout':
//timeout error logic here
break;

case 200:
//success logic here
break;
Expand Down Expand Up @@ -121,7 +125,7 @@ use think\Session;
class ServiceController extends RpcController {

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

Expand Down

0 comments on commit 147b15f

Please sign in to comment.