🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# swoole_http_client 此组件由swoole底层提供,由C语言编写,具有超高性能。 ## 安装: ```php 安装有swoole扩展即可 ``` ## 示例: ```php <?php /** * run with command * php start.php start */ use \Workerman\Worker; use \Workerman\Clients\Http; require_once '../Autoloader.php'; $worker = new Worker(); $worker->onWorkerStart = function (Worker $worker) { $url = 'http://www.workerman.net'; $request_method = 'get'; $data = ['uid'=>1]; $http = new Http($url, $request_method); $http->onResponse = function ($cli) { var_dump($cli->body); }; $http->request($data); }; $worker->count = 1; Worker::$logFile = __DIR__ . '/workerman.log'; Worker::$pidFile = __DIR__ . "/" . str_replace('/', '_', __FILE__) . ".pid"; // 运行所有服务 Worker::runAll(); ```