PHP code example of uniondrug / http-client
1. Go to this page and download the library: Download uniondrug/http-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uniondrug / http-client example snippets
return [
'default' => [
......
'providers' => [
......
\Uniondrug\HttpClient\HttpClientServiceProvider::class,
],
],
];
// 在 Injectable 继承下来的对象中:
$data = $this->getDI()->getShared('httpClient')->get($url);
// 或者 直接使用 属性方式
$data = $this->httpClient->get($url)